//------------------------------------------------------------------------------
// <auto-generated>
//     This code was generated by a tool.
//     Changes to this file may cause incorrect behavior and will be lost if
//     the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------

using Luban;


namespace GameConfig.TB
{
public sealed partial class TbGGift : Luban.BeanBase
{
    public TbGGift(ByteBuf _buf) 
    {
        Id = _buf.ReadInt();
        Name = _buf.ReadString();
        Tig = _buf.ReadString();
        Limit = (TbGEnum.TGiftLimit)_buf.ReadInt();
        LimitValue = _buf.ReadInt();
        {int __n0 = System.Math.Min(_buf.ReadSize(), _buf.Size);Exchanges = new TbGEntity.TResource[__n0];for(var __index0 = 0 ; __index0 < __n0 ; __index0++) { TbGEntity.TResource __e0;__e0 = TbGEntity.TResource.DeserializeTResource(_buf); Exchanges[__index0] = __e0;}}
        {int __n0 = System.Math.Min(_buf.ReadSize(), _buf.Size);Rewards = new TbGEntity.TReward[__n0];for(var __index0 = 0 ; __index0 < __n0 ; __index0++) { TbGEntity.TReward __e0;__e0 = TbGEntity.TReward.DeserializeTReward(_buf); Rewards[__index0] = __e0;}}
    }

    public static TbGGift DeserializeTbGGift(ByteBuf _buf)
    {
        return new TB.TbGGift(_buf);
    }

    /// <summary>
    /// 礼包唯一Id
    /// </summary>
    public readonly int Id;
    /// <summary>
    /// 礼包名称
    /// </summary>
    public readonly string Name;
    /// <summary>
    /// 描述
    /// </summary>
    public readonly string Tig;
    /// <summary>
    /// 礼包购买限制
    /// </summary>
    public readonly TbGEnum.TGiftLimit Limit;
    /// <summary>
    /// 限购数量
    /// </summary>
    public readonly int LimitValue;
    /// <summary>
    /// 兑换的资源
    /// </summary>
    public readonly TbGEntity.TResource[] Exchanges;
    /// <summary>
    /// 奖励
    /// </summary>
    public readonly TbGEntity.TReward[] Rewards;
   
    public const int __ID__ = 319065289;
    public override int GetTypeId() => __ID__;

    public  void ResolveRef(Tables tables)
    {
        
        
        
        
        
        foreach (var _e in Exchanges) { _e?.ResolveRef(tables); }
        foreach (var _e in Rewards) { _e?.ResolveRef(tables); }
    }

    public override string ToString()
    {
        return "{ "
        + "id:" + Id + ","
        + "name:" + Name + ","
        + "tig:" + Tig + ","
        + "limit:" + Limit + ","
        + "limitValue:" + LimitValue + ","
        + "exchanges:" + Luban.StringUtil.CollectionToString(Exchanges) + ","
        + "rewards:" + Luban.StringUtil.CollectionToString(Rewards) + ","
        + "}";
    }
}

}