/*
 * 作者:吴隆健
 * 日期: 2019-04-12
 * 时间: 17:43
 *
 */

using System;
using System.Collections.Generic;

namespace GameData.Club
{
    /// <summary>
    /// 竞技比赛常量数据
    /// </summary>
    public class ConstData
    {
        /// <summary>
        /// 名称
        /// </summary>
        public const string CLUB_NAME = "公会";

        /// <summary>
        /// 竞技比赛名称最小字符数
        /// </summary>
        public const int minClubNameLength = 3;

        /// <summary>
        /// 竞技比赛名称最大字符数
        /// </summary>
        public const int maxClubNameLength = 8;

        /// <summary>
        /// 竞技比赛最大成员数量
        /// </summary>
        public const int maxMemNum = 1000;

        /// <summary>
        /// 竞技比赛最大玩法数量
        /// </summary>
        public const int maxplaywayNum = 100;

        /// <summary>
        /// 一场游戏的最大人数
        /// </summary>
        public const int maxGamePlayerCount = 8;

        /// <summary>
        /// 最大竞技比赛数量
        /// </summary>
        public const int maxClubNumCnt = 10;

        /// <summary>
        /// 我的竞技比赛最大数量
        /// </summary>
        public const int maxMyClubNumCnt = 5;

        /// <summary>
        /// 我加入的竞技比赛最大数量
        /// </summary>
        public const int maxJoinClubNumCnt = 5;

        /// <summary>
        /// 一个玩家所能获得的最大记录数量
        /// </summary>
        public const int maxPlayerFightRecordCount = 50;

        /// <summary>
        /// 创建竞技比赛所需的房卡数量
        /// </summary>
        public const int minRoomCardForCreateClub = 200;

        /// <summary>
        /// 创建竞技比赛所需的道具数量
        /// </summary>
        public const int minPropForCreateClub = 1;

        /// <summary>
        /// 最多显示消息数量
        /// </summary>
        public const int maxMessageCnt = 20;

        /// <summary>
        /// 最多显示记录的数量
        /// </summary>
        public const int maxrecordCnt = 20;

        /// <summary>
        /// 如果是重置比赛积分的比赛设置，重置比赛时候的AwardId标记
        /// </summary>
        public const int AwardId_CloseMatchWithResetScore = 101;

        /// <summary>
        /// 颁奖的时候，无需要颁奖汇总显示的标记
        /// </summary>
        public const int AwardId_AwardNoInHistory = 100;

        /// <summary>
        /// ID 小于 100 认为是要在历史汇总中显示的
        /// 当前默认的需要汇总的ID
        /// </summary>
        public const int AwardId_Default = 99;

        /// <summary>
        /// 需要显示在历史中的汇总记录
        /// </summary>
        public const int AwardId_InHistoryCloseMatchWithResetScore = 98;

        /// <summary>
        /// 
        /// </summary>
        public ConstData()
        {
        }
    }

    /// <summary>
    /// 俱乐部设置
    /// </summary>
    public static class ClubSettingConst
    {
        public static int JoinDeskMode_JoinDesk = 0;
        public static int JoinDeskMode_CreateDesk = 1;
    }
    
    public static class ClubPlayerPositionType
    {
        public const int President = 0; // 会长
        public const int PlaceHolder = 1; // 占位
        public const int Manager = 2; // 管理员
        public const int Partner = 3; // 合伙人

        /// <summary>
        /// 可以管理俱乐部部分功能
        /// </summary>
        public static bool IsManageClub(int position)
        {
            return position == President
                   || position == Manager
                   || position == Partner;
        }
    }

    public static class ClubReadyTimeOutConfig
    {
        public static int DefaultReadyTimeOutSeconds = 30;
        
        public enum KickOption
        {
            SystemDefault, // 系统默认
            NeverKick, // 不踢出
            Sec10, // 10s
            Sec20, // 20s
            Sec30, // 30s
            Min1, // 1分钟
            Min2, // 2分钟
            Min3, // 3分钟
            Min5 // 5分钟
        }

        public class KickConfig
        {
            public KickOption Option { get; set; }
            public string Label { get; set; } // 界面显示的文字
            public int TimeoutSeconds { get; set; } // 倒计时秒数（统一单位）

            public KickConfig(KickOption option, string label, int timeoutSeconds)
            {
                Option = option;
                Label = label;
                TimeoutSeconds = timeoutSeconds;
            }
        }

        // 核心映射字典
        public static readonly List<KickConfig> KickSettings = new()
        {
            { new KickConfig(KickOption.SystemDefault, "系统默认", 30) },
            // { KickOption.NeverKick,     new KickConfig("不踢出", false, false, -1) },
            { new KickConfig(KickOption.Sec10, "10s", 10) },
            { new KickConfig(KickOption.Sec20, "20s", 20) },
            { new KickConfig(KickOption.Sec30, "30s", 30) },
            { new KickConfig(KickOption.Min1, "1分钟", 60) },
            { new KickConfig(KickOption.Min2, "2分钟", 120) },
            { new KickConfig(KickOption.Min3, "3分钟", 180) },
            { new KickConfig(KickOption.Min5, "5分钟", 300) }
        };
    }

    /// <summary>
    /// 服务器客户端公用方法
    /// </summary>
    public static class ClubSCFunc
    {
        public static string GetPositionName(int position)
        {
            switch (position)
            {
                case 0:
                    return "会长";
                case 1:
                case 2:
                    return "管理员";
                case 3:
                    return "合伙人";
                default:
                    return "会员";
            }
        }
    }
}