/**
 * <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
{

  [DataContract(Namespace="")]
  public partial class NPCFriendsDataItem : TBase
  {
    private int _Id;
    private string _NameKey;
    private string _NameCN;
    private string _NamePr;
    private int _Level;
    private int _Head;
    private int _Greeting;
    private int _Happy;
    private int _Taunt;
    private int _Fail;

    [DataMember(Order = 0)]
    public int Id
    {
      get
      {
        return _Id;
      }
      set
      {
        __isset.Id = true;
        this._Id = value;
      }
    }

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

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

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

    [DataMember(Order = 0)]
    public int Level
    {
      get
      {
        return _Level;
      }
      set
      {
        __isset.Level = true;
        this._Level = value;
      }
    }

    [DataMember(Order = 0)]
    public int Head
    {
      get
      {
        return _Head;
      }
      set
      {
        __isset.Head = true;
        this._Head = value;
      }
    }

    [DataMember(Order = 0)]
    public int Greeting
    {
      get
      {
        return _Greeting;
      }
      set
      {
        __isset.Greeting = true;
        this._Greeting = value;
      }
    }

    [DataMember(Order = 0)]
    public int Happy
    {
      get
      {
        return _Happy;
      }
      set
      {
        __isset.Happy = true;
        this._Happy = value;
      }
    }

    [DataMember(Order = 0)]
    public int Taunt
    {
      get
      {
        return _Taunt;
      }
      set
      {
        __isset.Taunt = true;
        this._Taunt = value;
      }
    }

    [DataMember(Order = 0)]
    public int Fail
    {
      get
      {
        return _Fail;
      }
      set
      {
        __isset.Fail = true;
        this._Fail = value;
      }
    }


    [DataMember(Order = 1)]
    public Isset __isset;
    [DataContract]
    public struct Isset
    {
      [DataMember]
      public bool Id;
      [DataMember]
      public bool NameKey;
      [DataMember]
      public bool NameCN;
      [DataMember]
      public bool NamePr;
      [DataMember]
      public bool Level;
      [DataMember]
      public bool Head;
      [DataMember]
      public bool Greeting;
      [DataMember]
      public bool Happy;
      [DataMember]
      public bool Taunt;
      [DataMember]
      public bool Fail;
    }

    #region XmlSerializer support

    public bool ShouldSerializeId()
    {
      return __isset.Id;
    }

    public bool ShouldSerializeNameKey()
    {
      return __isset.NameKey;
    }

    public bool ShouldSerializeNameCN()
    {
      return __isset.NameCN;
    }

    public bool ShouldSerializeNamePr()
    {
      return __isset.NamePr;
    }

    public bool ShouldSerializeLevel()
    {
      return __isset.Level;
    }

    public bool ShouldSerializeHead()
    {
      return __isset.Head;
    }

    public bool ShouldSerializeGreeting()
    {
      return __isset.Greeting;
    }

    public bool ShouldSerializeHappy()
    {
      return __isset.Happy;
    }

    public bool ShouldSerializeTaunt()
    {
      return __isset.Taunt;
    }

    public bool ShouldSerializeFail()
    {
      return __isset.Fail;
    }

    #endregion XmlSerializer support

    public NPCFriendsDataItem()
    {
    }

    public NPCFriendsDataItem DeepCopy()
    {
      var tmp0 = new NPCFriendsDataItem();
      if(__isset.Id)
      {
        tmp0.Id = this.Id;
      }
      tmp0.__isset.Id = this.__isset.Id;
      if((NameKey != null) && __isset.NameKey)
      {
        tmp0.NameKey = this.NameKey;
      }
      tmp0.__isset.NameKey = this.__isset.NameKey;
      if((NameCN != null) && __isset.NameCN)
      {
        tmp0.NameCN = this.NameCN;
      }
      tmp0.__isset.NameCN = this.__isset.NameCN;
      if((NamePr != null) && __isset.NamePr)
      {
        tmp0.NamePr = this.NamePr;
      }
      tmp0.__isset.NamePr = this.__isset.NamePr;
      if(__isset.Level)
      {
        tmp0.Level = this.Level;
      }
      tmp0.__isset.Level = this.__isset.Level;
      if(__isset.Head)
      {
        tmp0.Head = this.Head;
      }
      tmp0.__isset.Head = this.__isset.Head;
      if(__isset.Greeting)
      {
        tmp0.Greeting = this.Greeting;
      }
      tmp0.__isset.Greeting = this.__isset.Greeting;
      if(__isset.Happy)
      {
        tmp0.Happy = this.Happy;
      }
      tmp0.__isset.Happy = this.__isset.Happy;
      if(__isset.Taunt)
      {
        tmp0.Taunt = this.Taunt;
      }
      tmp0.__isset.Taunt = this.__isset.Taunt;
      if(__isset.Fail)
      {
        tmp0.Fail = this.Fail;
      }
      tmp0.__isset.Fail = this.__isset.Fail;
      return tmp0;
    }

    public async global::System.Threading.Tasks.Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken)
    {
      iprot.IncrementRecursionDepth();
      try
      {
        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);
              }
              else
              {
                await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken);
              }
              break;
            case 2:
              if (field.Type == TType.String)
              {
                NameKey = await iprot.ReadStringAsync(cancellationToken);
              }
              else
              {
                await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken);
              }
              break;
            case 3:
              if (field.Type == TType.String)
              {
                NameCN = await iprot.ReadStringAsync(cancellationToken);
              }
              else
              {
                await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken);
              }
              break;
            case 4:
              if (field.Type == TType.String)
              {
                NamePr = await iprot.ReadStringAsync(cancellationToken);
              }
              else
              {
                await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken);
              }
              break;
            case 5:
              if (field.Type == TType.I32)
              {
                Level = await iprot.ReadI32Async(cancellationToken);
              }
              else
              {
                await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken);
              }
              break;
            case 6:
              if (field.Type == TType.I32)
              {
                Head = await iprot.ReadI32Async(cancellationToken);
              }
              else
              {
                await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken);
              }
              break;
            case 7:
              if (field.Type == TType.I32)
              {
                Greeting = await iprot.ReadI32Async(cancellationToken);
              }
              else
              {
                await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken);
              }
              break;
            case 8:
              if (field.Type == TType.I32)
              {
                Happy = await iprot.ReadI32Async(cancellationToken);
              }
              else
              {
                await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken);
              }
              break;
            case 9:
              if (field.Type == TType.I32)
              {
                Taunt = await iprot.ReadI32Async(cancellationToken);
              }
              else
              {
                await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken);
              }
              break;
            case 10:
              if (field.Type == TType.I32)
              {
                Fail = await iprot.ReadI32Async(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);
      }
      finally
      {
        iprot.DecrementRecursionDepth();
      }
    }

    public async global::System.Threading.Tasks.Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken)
    {
      oprot.IncrementRecursionDepth();
      try
      {
        var tmp1 = new TStruct("NPCFriendsDataItem");
        await oprot.WriteStructBeginAsync(tmp1, cancellationToken);
        var tmp2 = new TField();
        if(__isset.Id)
        {
          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((NameKey != null) && __isset.NameKey)
        {
          tmp2.Name = "NameKey";
          tmp2.Type = TType.String;
          tmp2.ID = 2;
          await oprot.WriteFieldBeginAsync(tmp2, cancellationToken);
          await oprot.WriteStringAsync(NameKey, cancellationToken);
          await oprot.WriteFieldEndAsync(cancellationToken);
        }
        if((NameCN != null) && __isset.NameCN)
        {
          tmp2.Name = "NameCN";
          tmp2.Type = TType.String;
          tmp2.ID = 3;
          await oprot.WriteFieldBeginAsync(tmp2, cancellationToken);
          await oprot.WriteStringAsync(NameCN, cancellationToken);
          await oprot.WriteFieldEndAsync(cancellationToken);
        }
        if((NamePr != null) && __isset.NamePr)
        {
          tmp2.Name = "NamePr";
          tmp2.Type = TType.String;
          tmp2.ID = 4;
          await oprot.WriteFieldBeginAsync(tmp2, cancellationToken);
          await oprot.WriteStringAsync(NamePr, cancellationToken);
          await oprot.WriteFieldEndAsync(cancellationToken);
        }
        if(__isset.Level)
        {
          tmp2.Name = "Level";
          tmp2.Type = TType.I32;
          tmp2.ID = 5;
          await oprot.WriteFieldBeginAsync(tmp2, cancellationToken);
          await oprot.WriteI32Async(Level, cancellationToken);
          await oprot.WriteFieldEndAsync(cancellationToken);
        }
        if(__isset.Head)
        {
          tmp2.Name = "Head";
          tmp2.Type = TType.I32;
          tmp2.ID = 6;
          await oprot.WriteFieldBeginAsync(tmp2, cancellationToken);
          await oprot.WriteI32Async(Head, cancellationToken);
          await oprot.WriteFieldEndAsync(cancellationToken);
        }
        if(__isset.Greeting)
        {
          tmp2.Name = "Greeting";
          tmp2.Type = TType.I32;
          tmp2.ID = 7;
          await oprot.WriteFieldBeginAsync(tmp2, cancellationToken);
          await oprot.WriteI32Async(Greeting, cancellationToken);
          await oprot.WriteFieldEndAsync(cancellationToken);
        }
        if(__isset.Happy)
        {
          tmp2.Name = "Happy";
          tmp2.Type = TType.I32;
          tmp2.ID = 8;
          await oprot.WriteFieldBeginAsync(tmp2, cancellationToken);
          await oprot.WriteI32Async(Happy, cancellationToken);
          await oprot.WriteFieldEndAsync(cancellationToken);
        }
        if(__isset.Taunt)
        {
          tmp2.Name = "Taunt";
          tmp2.Type = TType.I32;
          tmp2.ID = 9;
          await oprot.WriteFieldBeginAsync(tmp2, cancellationToken);
          await oprot.WriteI32Async(Taunt, cancellationToken);
          await oprot.WriteFieldEndAsync(cancellationToken);
        }
        if(__isset.Fail)
        {
          tmp2.Name = "Fail";
          tmp2.Type = TType.I32;
          tmp2.ID = 10;
          await oprot.WriteFieldBeginAsync(tmp2, cancellationToken);
          await oprot.WriteI32Async(Fail, 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 NPCFriendsDataItem other)) return false;
      if (ReferenceEquals(this, other)) return true;
      return ((__isset.Id == other.__isset.Id) && ((!__isset.Id) || (global::System.Object.Equals(Id, other.Id))))
        && ((__isset.NameKey == other.__isset.NameKey) && ((!__isset.NameKey) || (global::System.Object.Equals(NameKey, other.NameKey))))
        && ((__isset.NameCN == other.__isset.NameCN) && ((!__isset.NameCN) || (global::System.Object.Equals(NameCN, other.NameCN))))
        && ((__isset.NamePr == other.__isset.NamePr) && ((!__isset.NamePr) || (global::System.Object.Equals(NamePr, other.NamePr))))
        && ((__isset.Level == other.__isset.Level) && ((!__isset.Level) || (global::System.Object.Equals(Level, other.Level))))
        && ((__isset.Head == other.__isset.Head) && ((!__isset.Head) || (global::System.Object.Equals(Head, other.Head))))
        && ((__isset.Greeting == other.__isset.Greeting) && ((!__isset.Greeting) || (global::System.Object.Equals(Greeting, other.Greeting))))
        && ((__isset.Happy == other.__isset.Happy) && ((!__isset.Happy) || (global::System.Object.Equals(Happy, other.Happy))))
        && ((__isset.Taunt == other.__isset.Taunt) && ((!__isset.Taunt) || (global::System.Object.Equals(Taunt, other.Taunt))))
        && ((__isset.Fail == other.__isset.Fail) && ((!__isset.Fail) || (global::System.Object.Equals(Fail, other.Fail))));
    }

    public override int GetHashCode() {
      int hashcode = 157;
      unchecked {
        if(__isset.Id)
        {
          hashcode = (hashcode * 397) + Id.GetHashCode();
        }
        if((NameKey != null) && __isset.NameKey)
        {
          hashcode = (hashcode * 397) + NameKey.GetHashCode();
        }
        if((NameCN != null) && __isset.NameCN)
        {
          hashcode = (hashcode * 397) + NameCN.GetHashCode();
        }
        if((NamePr != null) && __isset.NamePr)
        {
          hashcode = (hashcode * 397) + NamePr.GetHashCode();
        }
        if(__isset.Level)
        {
          hashcode = (hashcode * 397) + Level.GetHashCode();
        }
        if(__isset.Head)
        {
          hashcode = (hashcode * 397) + Head.GetHashCode();
        }
        if(__isset.Greeting)
        {
          hashcode = (hashcode * 397) + Greeting.GetHashCode();
        }
        if(__isset.Happy)
        {
          hashcode = (hashcode * 397) + Happy.GetHashCode();
        }
        if(__isset.Taunt)
        {
          hashcode = (hashcode * 397) + Taunt.GetHashCode();
        }
        if(__isset.Fail)
        {
          hashcode = (hashcode * 397) + Fail.GetHashCode();
        }
      }
      return hashcode;
    }

    public override string ToString()
    {
      var tmp3 = new StringBuilder("NPCFriendsDataItem(");
      int tmp4 = 0;
      if(__isset.Id)
      {
        if(0 < tmp4++) { tmp3.Append(", "); }
        tmp3.Append("Id: ");
        Id.ToString(tmp3);
      }
      if((NameKey != null) && __isset.NameKey)
      {
        if(0 < tmp4++) { tmp3.Append(", "); }
        tmp3.Append("NameKey: ");
        NameKey.ToString(tmp3);
      }
      if((NameCN != null) && __isset.NameCN)
      {
        if(0 < tmp4++) { tmp3.Append(", "); }
        tmp3.Append("NameCN: ");
        NameCN.ToString(tmp3);
      }
      if((NamePr != null) && __isset.NamePr)
      {
        if(0 < tmp4++) { tmp3.Append(", "); }
        tmp3.Append("NamePr: ");
        NamePr.ToString(tmp3);
      }
      if(__isset.Level)
      {
        if(0 < tmp4++) { tmp3.Append(", "); }
        tmp3.Append("Level: ");
        Level.ToString(tmp3);
      }
      if(__isset.Head)
      {
        if(0 < tmp4++) { tmp3.Append(", "); }
        tmp3.Append("Head: ");
        Head.ToString(tmp3);
      }
      if(__isset.Greeting)
      {
        if(0 < tmp4++) { tmp3.Append(", "); }
        tmp3.Append("Greeting: ");
        Greeting.ToString(tmp3);
      }
      if(__isset.Happy)
      {
        if(0 < tmp4++) { tmp3.Append(", "); }
        tmp3.Append("Happy: ");
        Happy.ToString(tmp3);
      }
      if(__isset.Taunt)
      {
        if(0 < tmp4++) { tmp3.Append(", "); }
        tmp3.Append("Taunt: ");
        Taunt.ToString(tmp3);
      }
      if(__isset.Fail)
      {
        if(0 < tmp4++) { tmp3.Append(", "); }
        tmp3.Append("Fail: ");
        Fail.ToString(tmp3);
      }
      tmp3.Append(')');
      return tmp3.ToString();
    }
  }

}
