/**
 * <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 WashStartMergeItem : TBase
  {
    private int _Id;
    private int _MergeId;
    private int _Row;
    private int _Line;
    private int _Lock;
    private string _Remark;

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

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

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

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

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

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


    [DataMember(Order = 1)]
    public Isset __isset;
    [DataContract]
    public struct Isset
    {
      [DataMember]
      public bool Id;
      [DataMember]
      public bool MergeId;
      [DataMember]
      public bool Row;
      [DataMember]
      public bool Line;
      [DataMember]
      public bool @Lock;
      [DataMember]
      public bool Remark;
    }

    #region XmlSerializer support

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

    public bool ShouldSerializeMergeId()
    {
      return __isset.MergeId;
    }

    public bool ShouldSerializeRow()
    {
      return __isset.Row;
    }

    public bool ShouldSerializeLine()
    {
      return __isset.Line;
    }

    public bool ShouldSerializeLock()
    {
      return __isset.@Lock;
    }

    public bool ShouldSerializeRemark()
    {
      return __isset.Remark;
    }

    #endregion XmlSerializer support

    public WashStartMergeItem()
    {
    }

    public WashStartMergeItem DeepCopy()
    {
      var tmp0 = new WashStartMergeItem();
      if(__isset.Id)
      {
        tmp0.Id = this.Id;
      }
      tmp0.__isset.Id = this.__isset.Id;
      if(__isset.MergeId)
      {
        tmp0.MergeId = this.MergeId;
      }
      tmp0.__isset.MergeId = this.__isset.MergeId;
      if(__isset.Row)
      {
        tmp0.Row = this.Row;
      }
      tmp0.__isset.Row = this.__isset.Row;
      if(__isset.Line)
      {
        tmp0.Line = this.Line;
      }
      tmp0.__isset.Line = this.__isset.Line;
      if(__isset.@Lock)
      {
        tmp0.Lock = this.Lock;
      }
      tmp0.__isset.@Lock = this.__isset.@Lock;
      if((Remark != null) && __isset.Remark)
      {
        tmp0.Remark = this.Remark;
      }
      tmp0.__isset.Remark = this.__isset.Remark;
      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.I32)
              {
                MergeId = await iprot.ReadI32Async(cancellationToken);
              }
              else
              {
                await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken);
              }
              break;
            case 3:
              if (field.Type == TType.I32)
              {
                Row = await iprot.ReadI32Async(cancellationToken);
              }
              else
              {
                await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken);
              }
              break;
            case 4:
              if (field.Type == TType.I32)
              {
                Line = await iprot.ReadI32Async(cancellationToken);
              }
              else
              {
                await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken);
              }
              break;
            case 5:
              if (field.Type == TType.I32)
              {
                Lock = await iprot.ReadI32Async(cancellationToken);
              }
              else
              {
                await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken);
              }
              break;
            case 6:
              if (field.Type == TType.String)
              {
                Remark = 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("WashStartMergeItem");
        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(__isset.MergeId)
        {
          tmp2.Name = "MergeId";
          tmp2.Type = TType.I32;
          tmp2.ID = 2;
          await oprot.WriteFieldBeginAsync(tmp2, cancellationToken);
          await oprot.WriteI32Async(MergeId, cancellationToken);
          await oprot.WriteFieldEndAsync(cancellationToken);
        }
        if(__isset.Row)
        {
          tmp2.Name = "Row";
          tmp2.Type = TType.I32;
          tmp2.ID = 3;
          await oprot.WriteFieldBeginAsync(tmp2, cancellationToken);
          await oprot.WriteI32Async(Row, cancellationToken);
          await oprot.WriteFieldEndAsync(cancellationToken);
        }
        if(__isset.Line)
        {
          tmp2.Name = "Line";
          tmp2.Type = TType.I32;
          tmp2.ID = 4;
          await oprot.WriteFieldBeginAsync(tmp2, cancellationToken);
          await oprot.WriteI32Async(Line, cancellationToken);
          await oprot.WriteFieldEndAsync(cancellationToken);
        }
        if(__isset.@Lock)
        {
          tmp2.Name = "Lock";
          tmp2.Type = TType.I32;
          tmp2.ID = 5;
          await oprot.WriteFieldBeginAsync(tmp2, cancellationToken);
          await oprot.WriteI32Async(Lock, cancellationToken);
          await oprot.WriteFieldEndAsync(cancellationToken);
        }
        if((Remark != null) && __isset.Remark)
        {
          tmp2.Name = "Remark";
          tmp2.Type = TType.String;
          tmp2.ID = 6;
          await oprot.WriteFieldBeginAsync(tmp2, cancellationToken);
          await oprot.WriteStringAsync(Remark, 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 WashStartMergeItem 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.MergeId == other.__isset.MergeId) && ((!__isset.MergeId) || (global::System.Object.Equals(MergeId, other.MergeId))))
        && ((__isset.Row == other.__isset.Row) && ((!__isset.Row) || (global::System.Object.Equals(Row, other.Row))))
        && ((__isset.Line == other.__isset.Line) && ((!__isset.Line) || (global::System.Object.Equals(Line, other.Line))))
        && ((__isset.@Lock == other.__isset.@Lock) && ((!__isset.@Lock) || (global::System.Object.Equals(Lock, other.Lock))))
        && ((__isset.Remark == other.__isset.Remark) && ((!__isset.Remark) || (global::System.Object.Equals(Remark, other.Remark))));
    }

    public override int GetHashCode() {
      int hashcode = 157;
      unchecked {
        if(__isset.Id)
        {
          hashcode = (hashcode * 397) + Id.GetHashCode();
        }
        if(__isset.MergeId)
        {
          hashcode = (hashcode * 397) + MergeId.GetHashCode();
        }
        if(__isset.Row)
        {
          hashcode = (hashcode * 397) + Row.GetHashCode();
        }
        if(__isset.Line)
        {
          hashcode = (hashcode * 397) + Line.GetHashCode();
        }
        if(__isset.@Lock)
        {
          hashcode = (hashcode * 397) + Lock.GetHashCode();
        }
        if((Remark != null) && __isset.Remark)
        {
          hashcode = (hashcode * 397) + Remark.GetHashCode();
        }
      }
      return hashcode;
    }

    public override string ToString()
    {
      var tmp3 = new StringBuilder("WashStartMergeItem(");
      int tmp4 = 0;
      if(__isset.Id)
      {
        if(0 < tmp4++) { tmp3.Append(", "); }
        tmp3.Append("Id: ");
        Id.ToString(tmp3);
      }
      if(__isset.MergeId)
      {
        if(0 < tmp4++) { tmp3.Append(", "); }
        tmp3.Append("MergeId: ");
        MergeId.ToString(tmp3);
      }
      if(__isset.Row)
      {
        if(0 < tmp4++) { tmp3.Append(", "); }
        tmp3.Append("Row: ");
        Row.ToString(tmp3);
      }
      if(__isset.Line)
      {
        if(0 < tmp4++) { tmp3.Append(", "); }
        tmp3.Append("Line: ");
        Line.ToString(tmp3);
      }
      if(__isset.@Lock)
      {
        if(0 < tmp4++) { tmp3.Append(", "); }
        tmp3.Append("Lock: ");
        Lock.ToString(tmp3);
      }
      if((Remark != null) && __isset.Remark)
      {
        if(0 < tmp4++) { tmp3.Append(", "); }
        tmp3.Append("Remark: ");
        Remark.ToString(tmp3);
      }
      tmp3.Append(')');
      return tmp3.ToString();
    }
  }

}
