using System.ComponentModel;

namespace SHH.CameraDashboard
{
    /// <summary>
    /// 服务节点模型，用于表示一个可连接的服务端点
    /// </summary>
    public class ServiceNodeModel : INotifyPropertyChanged
    {
        #region --- 公共属性 ---

        /// <summary>
        /// 获取或设置服务节点的名称
        /// </summary>
        public string ServiceNodeName { get; set; } = string.Empty;

        /// <summary>
        /// 获取或设置服务节点的IP地址
        /// </summary>
        public string ServiceNodeIp { get; set; } = string.Empty;

        /// <summary>
        /// 获取或设置服务节点的端口号
        /// </summary>
        public string ServiceNodePort { get; set; } = string.Empty;

        #endregion

        #region --- 状态属性 ---

        private string _status = "未检测";
        /// <summary>
        /// 获取或设置服务节点的连接状态（如：未检测、在线、离线）
        /// </summary>
        public string Status
        {
            get => _status;
            set
            {
                _status = value;
                OnPropertyChanged(nameof(Status));
            }
        }

        #endregion

        #region --- INotifyPropertyChanged 实现 ---

        /// <summary>
        /// 当属性值更改时发生
        /// </summary>
        public event PropertyChangedEventHandler? PropertyChanged;

        /// <summary>
        /// 引发 <see cref="PropertyChanged"/> 事件
        /// </summary>
        /// <param name="propertyName">已更改的属性名称</param>
        protected void OnPropertyChanged(string propertyName)
        {
            PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
        }

        #endregion
    }
}