using adas_core.Domain.Enums; using MongoDB.Bson; using Newtonsoft.Json; namespace adas_core.Domain.Models.MongoModels; public class Relay { public ObjectId Id { get; set; } public RelayEnum.Type Type { get; set; } = RelayEnum.Type.Door; public string? Driver { get; init; } public string Ip { get; init; } = string.Empty; public int Port { get; init; } public int RelayNumber { get; init; } = 1; public string? RelayName { get; init; } public int Total { get; init; } = 1; public int RefreshTime { get; set; } = 60; public bool Open { get; set; } public RelayEnum.Status Status { get; set; } = RelayEnum.Status.NotInitialized; public string? Username { get; init; } public string? Password { get; init; } public RelayEnum.Mode Mode { get; set; } = RelayEnum.Mode.OpenedOnClosedOff; public int? RebootDelay { get; set; } public bool Cache { get; set; } = true; public bool InUse { get; private set; } public RelayEnum.Status? ManualRelayStatus { get; set; } public bool Equals(Relay other) { return Driver == other.Driver && Ip == other.Ip && Port == other.Port && RelayNumber == other.RelayNumber && RelayName == other.RelayName && Total == other.Total && Username == other.Username && Password == other.Password; } public override string ToString() { return JsonConvert.SerializeObject(this); } }