/**
 * <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 LanguageDataItem : TBase
  {
    private int _Id;
    private string _Key;
    private string _En_US;
    private string _Zh_CN;
    private string _Pt_BR;

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

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

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

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

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


    [DataMember(Order = 1)]
    public Isset __isset;
    [DataContract]
    public struct Isset
    {
      [DataMember]
      public bool Id;
      [DataMember]
      public bool Key;
      [DataMember]
      public bool En_US;
      [DataMember]
      public bool Zh_CN;
      [DataMember]
      public bool Pt_BR;
    }

    #region XmlSerializer support

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

    public bool ShouldSerializeKey()
    {
      return __isset.Key;
    }

    public bool ShouldSerializeEn_US()
    {
      return __isset.En_US;
    }

    public bool ShouldSerializeZh_CN()
    {
      return __isset.Zh_CN;
    }

    public bool ShouldSerializePt_BR()
    {
      return __isset.Pt_BR;
    }

    #endregion XmlSerializer support

    public LanguageDataItem()
    {
    }

    public LanguageDataItem DeepCopy()
    {
      var tmp0 = new LanguageDataItem();
      if(__isset.Id)
      {
        tmp0.Id = this.Id;
      }
      tmp0.__isset.Id = this.__isset.Id;
      if((Key != null) && __isset.Key)
      {
        tmp0.Key = this.Key;
      }
      tmp0.__isset.Key = this.__isset.Key;
      if((En_US != null) && __isset.En_US)
      {
        tmp0.En_US = this.En_US;
      }
      tmp0.__isset.En_US = this.__isset.En_US;
      if((Zh_CN != null) && __isset.Zh_CN)
      {
        tmp0.Zh_CN = this.Zh_CN;
      }
      tmp0.__isset.Zh_CN = this.__isset.Zh_CN;
      if((Pt_BR != null) && __isset.Pt_BR)
      {
        tmp0.Pt_BR = this.Pt_BR;
      }
      tmp0.__isset.Pt_BR = this.__isset.Pt_BR;
      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)
              {
                Key = await iprot.ReadStringAsync(cancellationToken);
              }
              else
              {
                await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken);
              }
              break;
            case 3:
              if (field.Type == TType.String)
              {
                En_US = await iprot.ReadStringAsync(cancellationToken);
              }
              else
              {
                await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken);
              }
              break;
            case 4:
              if (field.Type == TType.String)
              {
                Zh_CN = await iprot.ReadStringAsync(cancellationToken);
              }
              else
              {
                await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken);
              }
              break;
            case 5:
              if (field.Type == TType.String)
              {
                Pt_BR = 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);
      }
      finally
      {
        iprot.DecrementRecursionDepth();
      }
    }

    public async global::System.Threading.Tasks.Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken)
    {
      oprot.IncrementRecursionDepth();
      try
      {
        var tmp1 = new TStruct("LanguageDataItem");
        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((Key != null) && __isset.Key)
        {
          tmp2.Name = "Key";
          tmp2.Type = TType.String;
          tmp2.ID = 2;
          await oprot.WriteFieldBeginAsync(tmp2, cancellationToken);
          await oprot.WriteStringAsync(Key, cancellationToken);
          await oprot.WriteFieldEndAsync(cancellationToken);
        }
        if((En_US != null) && __isset.En_US)
        {
          tmp2.Name = "En_US";
          tmp2.Type = TType.String;
          tmp2.ID = 3;
          await oprot.WriteFieldBeginAsync(tmp2, cancellationToken);
          await oprot.WriteStringAsync(En_US, cancellationToken);
          await oprot.WriteFieldEndAsync(cancellationToken);
        }
        if((Zh_CN != null) && __isset.Zh_CN)
        {
          tmp2.Name = "Zh_CN";
          tmp2.Type = TType.String;
          tmp2.ID = 4;
          await oprot.WriteFieldBeginAsync(tmp2, cancellationToken);
          await oprot.WriteStringAsync(Zh_CN, cancellationToken);
          await oprot.WriteFieldEndAsync(cancellationToken);
        }
        if((Pt_BR != null) && __isset.Pt_BR)
        {
          tmp2.Name = "Pt_BR";
          tmp2.Type = TType.String;
          tmp2.ID = 5;
          await oprot.WriteFieldBeginAsync(tmp2, cancellationToken);
          await oprot.WriteStringAsync(Pt_BR, 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 LanguageDataItem 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.Key == other.__isset.Key) && ((!__isset.Key) || (global::System.Object.Equals(Key, other.Key))))
        && ((__isset.En_US == other.__isset.En_US) && ((!__isset.En_US) || (global::System.Object.Equals(En_US, other.En_US))))
        && ((__isset.Zh_CN == other.__isset.Zh_CN) && ((!__isset.Zh_CN) || (global::System.Object.Equals(Zh_CN, other.Zh_CN))))
        && ((__isset.Pt_BR == other.__isset.Pt_BR) && ((!__isset.Pt_BR) || (global::System.Object.Equals(Pt_BR, other.Pt_BR))));
    }

    public override int GetHashCode() {
      int hashcode = 157;
      unchecked {
        if(__isset.Id)
        {
          hashcode = (hashcode * 397) + Id.GetHashCode();
        }
        if((Key != null) && __isset.Key)
        {
          hashcode = (hashcode * 397) + Key.GetHashCode();
        }
        if((En_US != null) && __isset.En_US)
        {
          hashcode = (hashcode * 397) + En_US.GetHashCode();
        }
        if((Zh_CN != null) && __isset.Zh_CN)
        {
          hashcode = (hashcode * 397) + Zh_CN.GetHashCode();
        }
        if((Pt_BR != null) && __isset.Pt_BR)
        {
          hashcode = (hashcode * 397) + Pt_BR.GetHashCode();
        }
      }
      return hashcode;
    }

    public override string ToString()
    {
      var tmp3 = new StringBuilder("LanguageDataItem(");
      int tmp4 = 0;
      if(__isset.Id)
      {
        if(0 < tmp4++) { tmp3.Append(", "); }
        tmp3.Append("Id: ");
        Id.ToString(tmp3);
      }
      if((Key != null) && __isset.Key)
      {
        if(0 < tmp4++) { tmp3.Append(", "); }
        tmp3.Append("Key: ");
        Key.ToString(tmp3);
      }
      if((En_US != null) && __isset.En_US)
      {
        if(0 < tmp4++) { tmp3.Append(", "); }
        tmp3.Append("En_US: ");
        En_US.ToString(tmp3);
      }
      if((Zh_CN != null) && __isset.Zh_CN)
      {
        if(0 < tmp4++) { tmp3.Append(", "); }
        tmp3.Append("Zh_CN: ");
        Zh_CN.ToString(tmp3);
      }
      if((Pt_BR != null) && __isset.Pt_BR)
      {
        if(0 < tmp4++) { tmp3.Append(", "); }
        tmp3.Append("Pt_BR: ");
        Pt_BR.ToString(tmp3);
      }
      tmp3.Append(')');
      return tmp3.ToString();
    }
  }

}
