/**
 * <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>
  /// 图集信息（Thrift序列化用）
  /// </summary>
  [DataContract(Namespace="")]
  public partial class ArtAtlasInfo : TBase
  {

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

    [DataMember(Order = 0)]
    public List<string> SpritePaths { get; set; }

    public ArtAtlasInfo()
    {
    }

    public ArtAtlasInfo(string @name, List<string> spritePaths) : this()
    {
      this.Name = @name;
      this.SpritePaths = spritePaths;
    }

    public ArtAtlasInfo DeepCopy()
    {
      var tmp0 = new ArtAtlasInfo();
      if((Name != null))
      {
        tmp0.Name = this.Name;
      }
      if((SpritePaths != null))
      {
        tmp0.SpritePaths = this.SpritePaths.DeepCopy();
      }
      return tmp0;
    }

    public async global::System.Threading.Tasks.Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken)
    {
      iprot.IncrementRecursionDepth();
      try
      {
        bool isset_name = false;
        bool isset_spritePaths = 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.String)
              {
                Name = await iprot.ReadStringAsync(cancellationToken);
                isset_name = true;
              }
              else
              {
                await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken);
              }
              break;
            case 2:
              if (field.Type == TType.List)
              {
                {
                  var _list1 = await iprot.ReadListBeginAsync(cancellationToken);
                  SpritePaths = new List<string>(_list1.Count);
                  for(int _i2 = 0; _i2 < _list1.Count; ++_i2)
                  {
                    string _elem3;
                    _elem3 = await iprot.ReadStringAsync(cancellationToken);
                    SpritePaths.Add(_elem3);
                  }
                  await iprot.ReadListEndAsync(cancellationToken);
                }
                isset_spritePaths = true;
              }
              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_name)
        {
          throw new TProtocolException(TProtocolException.INVALID_DATA);
        }
        if (!isset_spritePaths)
        {
          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 tmp4 = new TStruct("ArtAtlasInfo");
        await oprot.WriteStructBeginAsync(tmp4, cancellationToken);
        var tmp5 = new TField();
        if((Name != null))
        {
          tmp5.Name = "name";
          tmp5.Type = TType.String;
          tmp5.ID = 1;
          await oprot.WriteFieldBeginAsync(tmp5, cancellationToken);
          await oprot.WriteStringAsync(Name, cancellationToken);
          await oprot.WriteFieldEndAsync(cancellationToken);
        }
        if((SpritePaths != null))
        {
          tmp5.Name = "spritePaths";
          tmp5.Type = TType.List;
          tmp5.ID = 2;
          await oprot.WriteFieldBeginAsync(tmp5, cancellationToken);
          await oprot.WriteListBeginAsync(new TList(TType.String, SpritePaths.Count), cancellationToken);
          foreach (string _iter6 in SpritePaths)
          {
            await oprot.WriteStringAsync(_iter6, cancellationToken);
          }
          await oprot.WriteListEndAsync(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 ArtAtlasInfo other)) return false;
      if (ReferenceEquals(this, other)) return true;
      return global::System.Object.Equals(Name, other.Name)
        && TCollections.Equals(SpritePaths, other.SpritePaths);
    }

    public override int GetHashCode() {
      int hashcode = 157;
      unchecked {
        if((Name != null))
        {
          hashcode = (hashcode * 397) + Name.GetHashCode();
        }
        if((SpritePaths != null))
        {
          hashcode = (hashcode * 397) + TCollections.GetHashCode(SpritePaths);
        }
      }
      return hashcode;
    }

    public override string ToString()
    {
      var tmp7 = new StringBuilder("ArtAtlasInfo(");
      if((Name != null))
      {
        tmp7.Append(", Name: ");
        Name.ToString(tmp7);
      }
      if((SpritePaths != null))
      {
        tmp7.Append(", SpritePaths: ");
        SpritePaths.ToString(tmp7);
      }
      tmp7.Append(')');
      return tmp7.ToString();
    }
  }

}
