/**
 * <auto-generated>
 * Autogenerated by Thrift Compiler (0.22.0)
 * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
 * </auto-generated>
 */
using System;
using System.Collections;
using System.Collections.Generic;
using System.Text;
using System.IO;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
using Thrift;
using Thrift.Collections;
using System.Runtime.Serialization;
using Thrift.Protocol;
using Thrift.Protocol.Entities;
using Thrift.Protocol.Utilities;
using Thrift.Transport;
using Thrift.Transport.Client;


#pragma warning disable IDE0079  // remove unnecessary pragmas
#pragma warning disable IDE0017  // object init can be simplified
#pragma warning disable IDE0028  // collection init can be simplified
#pragma warning disable IDE0305  // collection init can be simplified
#pragma warning disable IDE0034  // simplify default expression
#pragma warning disable IDE0066  // use switch expression
#pragma warning disable IDE0090  // simplify new expression
#pragma warning disable IDE0290  // use primary CTOR
#pragma warning disable IDE1006  // parts of the code use IDL spelling
#pragma warning disable CA1822   // empty DeepCopy() methods still non-static
#pragma warning disable IDE0083  // pattern matching "that is not SomeType" requires net5.0 but we still support earlier versions

namespace Byway.Thrift.Data
{

  /// <summary>
  /// 资源项
  /// </summary>
  [DataContract(Namespace="")]
  public partial class ArtItem : TBase
  {
    private string _desc;
    private string _spritePath;
    private string _spineAssetPath;
    private string _spineAnimName;

    [DataMember(Order = 0)]
    public int Id { get; set; }

    [DataMember(Order = 0)]
    public string Name { get; set; }

    [DataMember(Order = 0)]
    public string Desc
    {
      get
      {
        return _desc;
      }
      set
      {
        __isset.@desc = true;
        this._desc = value;
      }
    }

    [DataMember(Order = 0)]
    public string SpritePath
    {
      get
      {
        return _spritePath;
      }
      set
      {
        __isset.spritePath = true;
        this._spritePath = value;
      }
    }

    [DataMember(Order = 0)]
    public string SpineAssetPath
    {
      get
      {
        return _spineAssetPath;
      }
      set
      {
        __isset.spineAssetPath = true;
        this._spineAssetPath = value;
      }
    }

    [DataMember(Order = 0)]
    public string SpineAnimName
    {
      get
      {
        return _spineAnimName;
      }
      set
      {
        __isset.spineAnimName = true;
        this._spineAnimName = value;
      }
    }


    [DataMember(Order = 1)]
    public Isset __isset;
    [DataContract]
    public struct Isset
    {
      [DataMember]
      public bool @desc;
      [DataMember]
      public bool spritePath;
      [DataMember]
      public bool spineAssetPath;
      [DataMember]
      public bool spineAnimName;
    }

    #region XmlSerializer support

    public bool ShouldSerializeDesc()
    {
      return __isset.@desc;
    }

    public bool ShouldSerializeSpritePath()
    {
      return __isset.spritePath;
    }

    public bool ShouldSerializeSpineAssetPath()
    {
      return __isset.spineAssetPath;
    }

    public bool ShouldSerializeSpineAnimName()
    {
      return __isset.spineAnimName;
    }

    #endregion XmlSerializer support

    public ArtItem()
    {
    }

    public ArtItem(int @id, string @name) : this()
    {
      this.Id = @id;
      this.Name = @name;
    }

    public ArtItem DeepCopy()
    {
      var tmp0 = new ArtItem();
      tmp0.Id = this.Id;
      if((Name != null))
      {
        tmp0.Name = this.Name;
      }
      if((Desc != null) && __isset.@desc)
      {
        tmp0.Desc = this.Desc;
      }
      tmp0.__isset.@desc = this.__isset.@desc;
      if((SpritePath != null) && __isset.spritePath)
      {
        tmp0.SpritePath = this.SpritePath;
      }
      tmp0.__isset.spritePath = this.__isset.spritePath;
      if((SpineAssetPath != null) && __isset.spineAssetPath)
      {
        tmp0.SpineAssetPath = this.SpineAssetPath;
      }
      tmp0.__isset.spineAssetPath = this.__isset.spineAssetPath;
      if((SpineAnimName != null) && __isset.spineAnimName)
      {
        tmp0.SpineAnimName = this.SpineAnimName;
      }
      tmp0.__isset.spineAnimName = this.__isset.spineAnimName;
      return tmp0;
    }

    public async global::System.Threading.Tasks.Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken)
    {
      iprot.IncrementRecursionDepth();
      try
      {
        bool isset_id = false;
        bool isset_name = false;
        TField field;
        await iprot.ReadStructBeginAsync(cancellationToken);
        while (true)
        {
          field = await iprot.ReadFieldBeginAsync(cancellationToken);
          if (field.Type == TType.Stop)
          {
            break;
          }

          switch (field.ID)
          {
            case 1:
              if (field.Type == TType.I32)
              {
                Id = await iprot.ReadI32Async(cancellationToken);
                isset_id = true;
              }
              else
              {
                await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken);
              }
              break;
            case 2:
              if (field.Type == TType.String)
              {
                Name = await iprot.ReadStringAsync(cancellationToken);
                isset_name = true;
              }
              else
              {
                await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken);
              }
              break;
            case 3:
              if (field.Type == TType.String)
              {
                Desc = await iprot.ReadStringAsync(cancellationToken);
              }
              else
              {
                await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken);
              }
              break;
            case 4:
              if (field.Type == TType.String)
              {
                SpritePath = await iprot.ReadStringAsync(cancellationToken);
              }
              else
              {
                await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken);
              }
              break;
            case 5:
              if (field.Type == TType.String)
              {
                SpineAssetPath = await iprot.ReadStringAsync(cancellationToken);
              }
              else
              {
                await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken);
              }
              break;
            case 6:
              if (field.Type == TType.String)
              {
                SpineAnimName = await iprot.ReadStringAsync(cancellationToken);
              }
              else
              {
                await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken);
              }
              break;
            default: 
              await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken);
              break;
          }

          await iprot.ReadFieldEndAsync(cancellationToken);
        }

        await iprot.ReadStructEndAsync(cancellationToken);
        if (!isset_id)
        {
          throw new TProtocolException(TProtocolException.INVALID_DATA);
        }
        if (!isset_name)
        {
          throw new TProtocolException(TProtocolException.INVALID_DATA);
        }
      }
      finally
      {
        iprot.DecrementRecursionDepth();
      }
    }

    public async global::System.Threading.Tasks.Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken)
    {
      oprot.IncrementRecursionDepth();
      try
      {
        var tmp1 = new TStruct("ArtItem");
        await oprot.WriteStructBeginAsync(tmp1, cancellationToken);
        var tmp2 = new TField();
        tmp2.Name = "id";
        tmp2.Type = TType.I32;
        tmp2.ID = 1;
        await oprot.WriteFieldBeginAsync(tmp2, cancellationToken);
        await oprot.WriteI32Async(Id, cancellationToken);
        await oprot.WriteFieldEndAsync(cancellationToken);
        if((Name != null))
        {
          tmp2.Name = "name";
          tmp2.Type = TType.String;
          tmp2.ID = 2;
          await oprot.WriteFieldBeginAsync(tmp2, cancellationToken);
          await oprot.WriteStringAsync(Name, cancellationToken);
          await oprot.WriteFieldEndAsync(cancellationToken);
        }
        if((Desc != null) && __isset.@desc)
        {
          tmp2.Name = "desc";
          tmp2.Type = TType.String;
          tmp2.ID = 3;
          await oprot.WriteFieldBeginAsync(tmp2, cancellationToken);
          await oprot.WriteStringAsync(Desc, cancellationToken);
          await oprot.WriteFieldEndAsync(cancellationToken);
        }
        if((SpritePath != null) && __isset.spritePath)
        {
          tmp2.Name = "spritePath";
          tmp2.Type = TType.String;
          tmp2.ID = 4;
          await oprot.WriteFieldBeginAsync(tmp2, cancellationToken);
          await oprot.WriteStringAsync(SpritePath, cancellationToken);
          await oprot.WriteFieldEndAsync(cancellationToken);
        }
        if((SpineAssetPath != null) && __isset.spineAssetPath)
        {
          tmp2.Name = "spineAssetPath";
          tmp2.Type = TType.String;
          tmp2.ID = 5;
          await oprot.WriteFieldBeginAsync(tmp2, cancellationToken);
          await oprot.WriteStringAsync(SpineAssetPath, cancellationToken);
          await oprot.WriteFieldEndAsync(cancellationToken);
        }
        if((SpineAnimName != null) && __isset.spineAnimName)
        {
          tmp2.Name = "spineAnimName";
          tmp2.Type = TType.String;
          tmp2.ID = 6;
          await oprot.WriteFieldBeginAsync(tmp2, cancellationToken);
          await oprot.WriteStringAsync(SpineAnimName, cancellationToken);
          await oprot.WriteFieldEndAsync(cancellationToken);
        }
        await oprot.WriteFieldStopAsync(cancellationToken);
        await oprot.WriteStructEndAsync(cancellationToken);
      }
      finally
      {
        oprot.DecrementRecursionDepth();
      }
    }

    public override bool Equals(object that)
    {
      if (!(that is ArtItem other)) return false;
      if (ReferenceEquals(this, other)) return true;
      return global::System.Object.Equals(Id, other.Id)
        && global::System.Object.Equals(Name, other.Name)
        && ((__isset.@desc == other.__isset.@desc) && ((!__isset.@desc) || (global::System.Object.Equals(Desc, other.Desc))))
        && ((__isset.spritePath == other.__isset.spritePath) && ((!__isset.spritePath) || (global::System.Object.Equals(SpritePath, other.SpritePath))))
        && ((__isset.spineAssetPath == other.__isset.spineAssetPath) && ((!__isset.spineAssetPath) || (global::System.Object.Equals(SpineAssetPath, other.SpineAssetPath))))
        && ((__isset.spineAnimName == other.__isset.spineAnimName) && ((!__isset.spineAnimName) || (global::System.Object.Equals(SpineAnimName, other.SpineAnimName))));
    }

    public override int GetHashCode() {
      int hashcode = 157;
      unchecked {
        hashcode = (hashcode * 397) + Id.GetHashCode();
        if((Name != null))
        {
          hashcode = (hashcode * 397) + Name.GetHashCode();
        }
        if((Desc != null) && __isset.@desc)
        {
          hashcode = (hashcode * 397) + Desc.GetHashCode();
        }
        if((SpritePath != null) && __isset.spritePath)
        {
          hashcode = (hashcode * 397) + SpritePath.GetHashCode();
        }
        if((SpineAssetPath != null) && __isset.spineAssetPath)
        {
          hashcode = (hashcode * 397) + SpineAssetPath.GetHashCode();
        }
        if((SpineAnimName != null) && __isset.spineAnimName)
        {
          hashcode = (hashcode * 397) + SpineAnimName.GetHashCode();
        }
      }
      return hashcode;
    }

    public override string ToString()
    {
      var tmp3 = new StringBuilder("ArtItem(");
      tmp3.Append(", Id: ");
      Id.ToString(tmp3);
      if((Name != null))
      {
        tmp3.Append(", Name: ");
        Name.ToString(tmp3);
      }
      if((Desc != null) && __isset.@desc)
      {
        tmp3.Append(", Desc: ");
        Desc.ToString(tmp3);
      }
      if((SpritePath != null) && __isset.spritePath)
      {
        tmp3.Append(", SpritePath: ");
        SpritePath.ToString(tmp3);
      }
      if((SpineAssetPath != null) && __isset.spineAssetPath)
      {
        tmp3.Append(", SpineAssetPath: ");
        SpineAssetPath.ToString(tmp3);
      }
      if((SpineAnimName != null) && __isset.spineAnimName)
      {
        tmp3.Append(", SpineAnimName: ");
        SpineAnimName.ToString(tmp3);
      }
      tmp3.Append(')');
      return tmp3.ToString();
    }
  }

}
