Files
GreenHomeBack/src/GreenHome.Application/Dtos/Alert/RelayConditionDto.cs
2026-09-11 23:52:11 +03:30

55 lines
1.7 KiB
C#
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

namespace GreenHome.Application;
/// <summary>
/// DTO for relay conditions sent to the device firmware.
/// </summary>
public sealed class RelayConditionDto
{
public int Enabled { get; set; }
/// <summary>شناسه رله برای سازگاری با فریم‌ور قبلی (مثلاً R1)</summary>
public string Relay { get; set; } = string.Empty;
/// <summary>شماره رله (۱ تا RelayCount)</summary>
public int RelayIndex { get; set; }
/// <summary>نام نمایشی رله (فن، هیتر و ...)</summary>
public string Name { get; set; } = string.Empty;
/// <summary>گروه‌های روشن شدن (OR بین گروه‌ها)</summary>
public List<RelayGroupDto> On { get; set; } = new();
/// <summary>گروه‌های خاموش شدن (OR بین گروه‌ها)</summary>
public List<RelayGroupDto> Off { get; set; } = new();
}
/// <summary>
/// یک گروه شرط (AND داخل گروه)
/// </summary>
public sealed class RelayGroupDto
{
/// <summary>برچسب اختیاری گروه برای لاگ/اعلان</summary>
public string? Label { get; set; }
public List<RelayRuleDto> Conditions { get; set; } = new();
}
/// <summary>
/// یک شرط واحد: سنسوری (Kind=0) یا زمانی (Kind=1)
/// </summary>
public sealed class RelayRuleDto
{
/// <summary>نوع شرط: 0 = سنسوری، 1 = زمانی</summary>
public int Kind { get; set; }
// سنسوری
public int? Sensor { get; set; }
public int? Op { get; set; }
public decimal? V1 { get; set; }
public decimal? V2 { get; set; }
// زمانی (دقیقه از نیمه‌شب)
public int? Start { get; set; }
public int? End { get; set; }
}