using System.ComponentModel;

namespace StandardScene.Signal.Model
{
    /// <summary>
    /// 单个机构运行态快照，供 MissionStatus / 监视面板展示。
    /// 由 <see cref="StandardScene.Signal.Plc.PlcStationRuntime.ToSnapshot"/> 拷贝，UI 不要直接绑 Runtime。
    /// </summary>
    public class PlcStationSnapshot
    {
        /// <summary>机构逻辑名。</summary>
        [DisplayName("机构")] public string JgName { get; set; } = "";

        /// <summary>最近一拍 PLC 读写是否成功。</summary>
        [DisplayName("连接")] public bool IsConnected { get; set; }

        /// <summary>PLC→调度读字节的枚举名（允许进入 / 允许离开 / 无状态）。</summary>
        [DisplayName("读信号")] public string ReadSignal { get; set; } = "";

        /// <summary>调度目标写字节的枚举名。</summary>
        [DisplayName("写信号")] public string WriteSignal { get; set; } = "";

        /// <summary>从写地址回读到的枚举名，用于确认 PLC 是否已吃进目标值。</summary>
        [DisplayName("回读写值")] public string ReadWriteSignal { get; set; } = "";

        /// <summary>已报到在机构内的 AGV 号，0 表示没有。</summary>
        [DisplayName("机构内车")] public int InAgvNo { get; set; }

        /// <summary>已获准进入、正在往机构开的 AGV 号，0 表示没有。</summary>
        [DisplayName("请求进入车")] public int RequestInAgvNo { get; set; }

        /// <summary>目标写字节是否已与回读一致。</summary>
        [DisplayName("写入成功")] public bool WriteSuccess { get; set; }

        /// <summary>Worker 内存心跳翻转，表示线程在跑。</summary>
        [DisplayName("心跳")] public bool Heart { get; set; }

        /// <summary>最近一次断线或周期异常原因。</summary>
        [DisplayName("最近错误")] public string LastError { get; set; } = "";
    }
}
