namespace SHH.MjpegPlayer
{
    /// <summary>图片通道</summary>
    public class ImageChannel
    {
        /// <summary>进程 ID</summary>
        public Int32 ProcId { get; set; }

        /// <summary>设备 ID</summary>
        public Int64 DeviceId { get; set; }

        /// <summary>设备 IP</summary>
        public string IpAddress { get; set; } = string.Empty;

        /// <summary>名称</summary>
        public string Name { get; set; } = string.Empty;

        /// <summary>类型</summary>
        public string Type { get; set; } = string.Empty;

        /// <summary>图像宽度</summary>
        public int ImageWidth { get; set; }

        /// <summary>图像高度</summary>
        public int ImageHeight { get; set; }

        /// <summary>更新时间</summary>
        public DateTime UpdateTime { get; set; }

        /// <summary>是否正在播放</summary>
        public bool IsPlaying { get; set; }

        /// <summary>是否需要推流到 Rtmp 服务器</summary>
        public bool UseRtmp { get; set; } = true;

        #region RtmpUri

        private string _rtmpUri = string.Empty;

        /// <summary>Rtmp 推流地址</summary>
        public string RtmpUri
        {
            get => _rtmpUri;
            set
            {
                if (_rtmpUri == value)
                    return;
                _rtmpUri = value;
            }
        }

        #endregion

        #region TestUri

        /// <summary>测试地址</summary>
        public string TestUri => $"?id={DeviceId}&typeCode={Type}";

        #endregion
    }
}