using System;
using System.Collections.Generic;
using System.Linq;
using GameData;
using MessagePack;
using Newtonsoft.Json;

namespace GameMessage
{
    [Serializable]
    [MessagePackObject]
    public class CardStyleInfo
    {
        /// <summary>
        /// 牌型
        /// </summary>
        [JsonProperty("cs")]
        [Key(0)]
        public int CardStyle;

        /// <summary>
        /// 关键牌
        /// </summary>
        [JsonProperty("cv")]
        [Key(1)]
        public int CardValue;

        /// <summary>
        /// 牌数量
        /// </summary>
        [JsonProperty("cc")]
        [Key(2)]
        public int CardCnt;
        
        /// <summary>
        /// 组成牌型的缺少牌值 （主要用于癞子的替换）
        /// </summary>
        [JsonProperty("clv")]
        [Key(3)]
        public int[] CardLackValues;
        
        /// <summary>
        /// int类型的自定义数据
        /// </summary>
        [JsonProperty("ci")]
        [Key(4)]
        public int CustomInt;

        [SerializationConstructor]
        public CardStyleInfo()
        {
        }
        
        public CardStyleInfo(int cardStyle, int cardValue, int cardCnt)
        {
            CardStyle = cardStyle;
            CardValue = cardValue;
            CardCnt = cardCnt;
        }
        
        // public CardStyleInfo(int cardStyle, List<Card> cards)
        // {
        //     CardStyle = cardStyle;
        //     CardValue = cards.First().Value;
        //     CardCnt = cards.Count;
        // }

        // public override string ToString()
        // {
        //     if (DataCardConst.CardStyleReadableText.TryGetValue(CardStyle, out string cardStyleText))
        //     {
        //         return $"{cardStyleText}_{CardValue}_{CardCnt}";
        //     }
        //     
        //     return $"{CardStyle}_{CardValue}_{CardCnt}";
        // }
    }
}