using MessagePack;

namespace GameFix.Mahjong
{
    /// <summary>
    /// 杠类型
    /// </summary>
    public enum GangStyle : byte
    {
        GangOther = 0,
        GangPeng = 1,
        GangSelf = 2,
    }
    
    /// <summary>
    /// 吃类型
    /// </summary>
    public enum ChiStyle : byte
    {
        Left = 0,
        Middle = 1,
        Right = 2
    }
    
    /// <summary>
    /// 杠信息
    /// </summary>
    [MessagePackObject]
    public class GangInfo
    {
        /// <summary>
        /// 杠的牌
        /// </summary>
        [Key(0)]
        public sbyte Pai;

        /// <summary>
        /// 0杠别人  1杠碰的牌(明杠),  2杠手里的牌(暗杠) 3单牌补杠
        /// </summary>
        [Key(1)]
        public byte Style;
    }

    /// <summary>
    /// 补牌信息
    /// </summary>
    public class BuPaiInfo
    {
        /// <summary>
        /// 补的牌
        /// </summary>
        public sbyte Pai;

        /// <summary>
        /// 补牌方式
        /// </summary>
        public byte Style;
    }
    
    /// <summary>
    /// 吃信息
    /// </summary>
    [MessagePackObject]
    public class ChiInfo
    {
        /// <summary>
        /// 吃信息的数量
        /// </summary>
        [Key(0)]
        public int Cnt;

        /// <summary>
        /// 吃类型
        /// </summary>
        [Key(1)]
        public int[] Style = new int[3];

        /// <summary>
        /// 用什么牌可以去吃
        /// </summary>
        [Key(2)]
        public sbyte[,] Pai = new sbyte[3, 2];
    }
    
    public enum QueType : byte
    {
        /// <summary>
        /// 吃
        /// </summary>
        Chi = 0,

        /// <summary>
        /// 碰
        /// </summary>
        Peng = 1,

        /// <summary>
        /// 杠
        /// </summary>
        Gang = 2,
        
        /// <summary>
        /// 补牌
        /// </summary>
        BuPai = 4,

        /// <summary>
        /// 花杠
        /// </summary>
        HuaGang = 5,

        /// <summary>
        /// 宝牌
        /// </summary>
        BaoPai = 6,
    }
    
    [MessagePackObject]
    public class QueInfo
    {
        /// <summary>
        /// 谁提供的牌 -1 表示自己
        /// </summary>
        [Key(0)]
        public int Supply;

        /// <summary>
        /// 吃碰杠的牌
        /// </summary>
        [Key(1)]
        public sbyte[] Pai = new sbyte[3];

        /// <summary>
        /// 吃的牌
        /// </summary>
        [Key(2)]
        public sbyte Cp;

        /// <summary>
        /// 阙的类型
        /// </summary>
        [Key(3)]
        public byte QueStyle;
    }
    
    /// <summary>
    /// 麻将游戏状态
    /// </summary>
    public enum MahjongGameState : int
    {
        /// <summary>
        /// 抓牌
        /// </summary>
        ZhuaPai = 0,

        /// <summary>
        /// 翻宝 -- 客户端自己处理
        /// </summary>
        FanBao = 1,

        /// <summary>
        /// 打牌状态
        /// </summary>
        DaPai = 2,

        /// <summary>
        /// 流局
        /// </summary>
        LiuJu = 3,

        /// <summary>
        /// 正常结束
        /// </summary>
        GameOver = 4,

        /// <summary>
        /// 加买分
        /// </summary>
        MaiScore = 5,

        /// <summary>
        /// 掷骰子阶段
        /// </summary>
        ZhiTouZi = 6,

        /// <summary>
        /// 亮精阶段
        /// </summary>
        LiangJing = 7,

        /// <summary>
        /// 前翻精阶段
        /// </summary>
        QianFanJing = 8,

        /// <summary>
        /// 后翻精阶段
        /// </summary>
        HouFanJing = 9,

        /// <summary>
        /// 翻宝前阶段
        /// </summary>
        FanBaoQian = 10,

        /// <summary>
        /// 翻宝后阶段
        /// </summary>
        FanBaoHou = 11,

        /// <summary>
        /// 随精阶段
        /// </summary>
        SuiJing = 12,
    }
    
}
