/**
 * <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 DefineSymbol : TBase
  {
    private bool _is_chinese_on;
    private int _package_version;

    [DataMember(Order = 0)]
    public bool Is_chinese_on
    {
      get
      {
        return _is_chinese_on;
      }
      set
      {
        __isset.is_chinese_on = true;
        this._is_chinese_on = value;
      }
    }

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


    [DataMember(Order = 1)]
    public Isset __isset;
    [DataContract]
    public struct Isset
    {
      [DataMember]
      public bool is_chinese_on;
      [DataMember]
      public bool package_version;
    }

    #region XmlSerializer support

    public bool ShouldSerializeIs_chinese_on()
    {
      return __isset.is_chinese_on;
    }

    public bool ShouldSerializePackage_version()
    {
      return __isset.package_version;
    }

    #endregion XmlSerializer support

    public DefineSymbol()
    {
    }

    public DefineSymbol DeepCopy()
    {
      var tmp0 = new DefineSymbol();
      if(__isset.is_chinese_on)
      {
        tmp0.Is_chinese_on = this.Is_chinese_on;
      }
      tmp0.__isset.is_chinese_on = this.__isset.is_chinese_on;
      if(__isset.package_version)
      {
        tmp0.Package_version = this.Package_version;
      }
      tmp0.__isset.package_version = this.__isset.package_version;
      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.Bool)
              {
                Is_chinese_on = await iprot.ReadBoolAsync(cancellationToken);
              }
              else
              {
                await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken);
              }
              break;
            case 2:
              if (field.Type == TType.I32)
              {
                Package_version = 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("DefineSymbol");
        await oprot.WriteStructBeginAsync(tmp1, cancellationToken);
        var tmp2 = new TField();
        if(__isset.is_chinese_on)
        {
          tmp2.Name = "is_chinese_on";
          tmp2.Type = TType.Bool;
          tmp2.ID = 1;
          await oprot.WriteFieldBeginAsync(tmp2, cancellationToken);
          await oprot.WriteBoolAsync(Is_chinese_on, cancellationToken);
          await oprot.WriteFieldEndAsync(cancellationToken);
        }
        if(__isset.package_version)
        {
          tmp2.Name = "package_version";
          tmp2.Type = TType.I32;
          tmp2.ID = 2;
          await oprot.WriteFieldBeginAsync(tmp2, cancellationToken);
          await oprot.WriteI32Async(Package_version, 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 DefineSymbol other)) return false;
      if (ReferenceEquals(this, other)) return true;
      return ((__isset.is_chinese_on == other.__isset.is_chinese_on) && ((!__isset.is_chinese_on) || (global::System.Object.Equals(Is_chinese_on, other.Is_chinese_on))))
        && ((__isset.package_version == other.__isset.package_version) && ((!__isset.package_version) || (global::System.Object.Equals(Package_version, other.Package_version))));
    }

    public override int GetHashCode() {
      int hashcode = 157;
      unchecked {
        if(__isset.is_chinese_on)
        {
          hashcode = (hashcode * 397) + Is_chinese_on.GetHashCode();
        }
        if(__isset.package_version)
        {
          hashcode = (hashcode * 397) + Package_version.GetHashCode();
        }
      }
      return hashcode;
    }

    public override string ToString()
    {
      var tmp3 = new StringBuilder("DefineSymbol(");
      int tmp4 = 0;
      if(__isset.is_chinese_on)
      {
        if(0 < tmp4++) { tmp3.Append(", "); }
        tmp3.Append("Is_chinese_on: ");
        Is_chinese_on.ToString(tmp3);
      }
      if(__isset.package_version)
      {
        if(0 < tmp4++) { tmp3.Append(", "); }
        tmp3.Append("Package_version: ");
        Package_version.ToString(tmp3);
      }
      tmp3.Append(')');
      return tmp3.ToString();
    }
  }

}
