using MessagePack;
using System.Collections.Generic;

namespace SHH.Contracts
{
    /// <summary>
    /// [控制面] 状态全量快照包
    /// </summary>
    [MessagePackObject]
    public class StatusBatchPayload
    {
        // [新增] 协议类型标识 (人工可读)
        // 建议值: "STATUS_BATCH" 或 "设备状态全量包"
        [Key(0)]
        public string Protocol { get; set; } = "STATUS_BATCH";

        [Key(1)]
        public List<StatusEventPayload> Items { get; set; }
            = new List<StatusEventPayload>();

        [Key(2)]
        public long Timestamp { get; set; }
    }

    /// <summary>
    /// [控制面] 设备状态变更通知包
    /// </summary>
    [MessagePackObject]
    public class StatusEventPayload
    {
        [Key(0)]
        public string CameraId { get; set; }

        /// <summary>
        /// true: 上线/活跃, false: 离线/超时
        /// </summary>
        [Key(1)]
        public bool IsOnline { get; set; }

        /// <summary>
        /// 变更原因 (e.g. "Ping Success", "Frame Timeout")
        /// </summary>
        [Key(2)]
        public string Reason { get; set; }

        [Key(3)]
        public long Timestamp { get; set; }
    }
}