using Domain = GreenHome.Domain; namespace GreenHome.Application; /// /// تنظیمات یک رله دستگاه /// public sealed class DeviceRelayDto { public int Id { get; set; } public int DeviceSettingsId { get; set; } public int RelayIndex { get; set; } public string Name { get; set; } = string.Empty; public bool IsEnabled { get; set; } = true; public Domain.RelayKind RelayKind { get; set; } = Domain.RelayKind.Generic; /// /// گروه‌های شرط رله. گروه‌های هم‌عمل (روشن یا خاموش) با OR ترکیب می‌شوند /// و شرایط داخل هر گروه با AND. /// public List RuleGroups { get; set; } = new(); } /// /// یک گروه شرط برای روشن یا خاموش شدن رله /// public sealed class DeviceRelayRuleGroupDto { public int Id { get; set; } /// اقدام: روشن (On) یا خاموش (Off) public Domain.RelayAction Action { get; set; } = Domain.RelayAction.On; /// برچسب اختیاری گروه برای لاگ/اعلان public string? Label { get; set; } public int Order { get; set; } public List Conditions { get; set; } = new(); } /// /// یک شرط واحد داخل گروه (سنسوری یا زمانی) /// public sealed class DeviceRelayRuleConditionDto { public int Id { get; set; } /// نوع شرط: سنسوری (0) یا زمانی (1) public Domain.RelayConditionType ConditionType { get; set; } = Domain.RelayConditionType.Sensor; // ---- شرط سنسوری ---- public Domain.SensorType? SensorType { get; set; } public Domain.ComparisonType? ComparisonType { get; set; } public decimal? Value1 { get; set; } public decimal? Value2 { get; set; } // ---- شرط زمانی (دقیقه از نیمه‌شب) ---- public int? StartMinutes { get; set; } public int? EndMinutes { get; set; } public int Order { get; set; } }