using System.ComponentModel;
using Newtonsoft.Json;

namespace StandardScene.Signal.Model
{
    /// <summary>
    /// 握手点。JGControl / PointControl 填机构、工位、动作；定时充电 / 限流走附加参数。
    /// 旧 JSON 仅有 SignalParams 时仍可解析。
    /// </summary>
    [SignalTable("handshake", "handshake-points.json", "握手点", Order = 3)]
    [Category("握手点数据管理")]
    [DisplayName("握手点配置列表")]
    public class HandshakePointModel
    {
        [DisplayName("站点")]
        public int Sit { get; set; }

        /// <summary>JGControl / PointControl / TimedCharging / RateFlowControl。</summary>
        [DisplayName("信号类型")]
        [SignalSelect("JGControl", "PointControl", "TimedCharging", "RateFlowControl")]
        public string SignalType { get; set; } = "JGControl";

        [DisplayName("机构名称")]
        public string JgName { get; set; } = "";

        [DisplayName("工位编号")]
        public string DockId { get; set; } = "";

        /// <summary>JGControl：RequestIn / Arrived；PointControl：UP1 / UP2 / Down1 / Down2。</summary>
        [DisplayName("动作")]
        [SignalSelect("RequestIn", "Arrived", "UP1", "UP2", "Down1", "Down2")]
        public string Action { get; set; } = "";

        /// <summary>
        /// TimedCharging：最长秒;上限电量;下限电量。
        /// RateFlowControl：区域;车组;限额;点列表。
        /// JGControl 可选限流：区域-车组-限额-点列表。
        /// </summary>
        [DisplayName("附加参数")]
        public string ExtraParams { get; set; } = "";

        /// <summary>旧字段。新配置可空，加载时由上面几列拼回。</summary>
        [Browsable(false)]
        [JsonProperty(DefaultValueHandling = DefaultValueHandling.Ignore)]
        public string SignalParams { get; set; }
    }
}
