using LitJson;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace CTZLauncher.Modules.CTZServer
{
    /// <summary>
    /// 实例化服务器信息
    /// </summary>
    public class CTZServer
    {
        /// <summary>
        /// 大区列表
        /// </summary>
        [JsonPropertyName("areas")]
        public List<Area> Areas { get; set; }
    }
    /// <summary>
    /// 服务器大区信息
    /// </summary>
    public class Area
    {
        /// <summary>
        /// 大区名称
        /// </summary>
        [JsonPropertyName("name")]
        public string Name { get; set; }
        /// <summary>
        /// 大区服务器列表
        /// </summary>
        [JsonPropertyName("servers")]
        public List<Server> Servers { get; set; }
    }
    /// <summary>
    /// 服务器信息
    /// </summary>
    public class Server
    {
        /// <summary>
        /// 服务器名称
        /// </summary>
        [JsonPropertyName("name")]
        public string Name { get; set; }

        /// <summary>
        /// 服务器地址
        /// </summary>
        [JsonPropertyName("address")]
        public string Address { get; set; }

        /// <summary>
        /// 服务器端口
        /// </summary>
        [JsonPropertyName("port")]
        public ushort Port { get; set; }

        /// <summary>
        /// 服务器简介
        /// </summary>
        [JsonPropertyName("info")]
        public string Info { get; set; }

        /// <summary>
        /// 客户端版本
        /// </summary>
        [JsonPropertyName("version")]
        public string Version { get; set; }

        /// <summary>
        /// 客户端下载地址
        /// </summary>
        [JsonPropertyName("url")]
        public string Url { get; set; }

        /// <summary>
        /// 客户端依赖项
        /// </summary>
        [JsonPropertyName("depend")]
        public string Depend { get; set; }

        /// <summary>
        /// 获得服务器链接
        /// </summary>
        /// <returns>服务器链接</returns>
        public override string ToString()
        {
            return string.Format("{0}:{1}", Address, Port);
        }
    }

}
