namespace MiGu.Server.Fleet;

/// <summary>
/// 车辆报警的平台侧记录（表 vehicle_alarms）。
/// SimpleLite 只在 SSE/状态里给出「当前是否报警 + 文案」，无历史；平台按车对帐：
/// 出现报警→开一条 active 记录，报警文案变化→更新，报警消失→置为 cleared 并记录恢复时间/持续时长。
/// 永不删除=完整历史，重启/刷新不丢，SimpleLite 离线也可查。
/// </summary>
public sealed class VehicleAlarmRecord
{
    public string Id { get; set; } = Guid.NewGuid().ToString("D");
    public int CarId { get; set; }
    public string CarName { get; set; } = "";
    /// <summary>报警文案（车体_AlarmInfo）。</summary>
    public string Info { get; set; } = "";
    /// <summary>报警级别（车体_AlarmLevel，未知为 0）。</summary>
    public int Level { get; set; }
    /// <summary>active | cleared</summary>
    public string Status { get; set; } = "active";
    public DateTimeOffset FirstAt { get; set; }
    public DateTimeOffset LastAt { get; set; }
    public DateTimeOffset? ResolvedAt { get; set; }
    /// <summary>持续时长（秒），恢复后写入。</summary>
    public long? DurationSecs { get; set; }
    /// <summary>预留：平台侧确认（不代表车端消警）。</summary>
    public bool Acknowledged { get; set; }
    public DateTimeOffset? AcknowledgedAt { get; set; }
    public string? AcknowledgedBy { get; set; }
}
