/**
 * <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 DailyTaskConfigItem : TBase
  {
    private int _Id;
    private int _TaskPoolId;
    private string _OpenCondition;
    private int _TaskType;
    private string _Describe;
    private int _TaskNum;
    private string _RewardID;
    private string _RewardCnt;
    private int _Active;

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

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

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

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

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

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

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

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

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


    [DataMember(Order = 1)]
    public Isset __isset;
    [DataContract]
    public struct Isset
    {
      [DataMember]
      public bool Id;
      [DataMember]
      public bool TaskPoolId;
      [DataMember]
      public bool OpenCondition;
      [DataMember]
      public bool TaskType;
      [DataMember]
      public bool Describe;
      [DataMember]
      public bool TaskNum;
      [DataMember]
      public bool RewardID;
      [DataMember]
      public bool RewardCnt;
      [DataMember]
      public bool Active;
    }

    #region XmlSerializer support

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

    public bool ShouldSerializeTaskPoolId()
    {
      return __isset.TaskPoolId;
    }

    public bool ShouldSerializeOpenCondition()
    {
      return __isset.OpenCondition;
    }

    public bool ShouldSerializeTaskType()
    {
      return __isset.TaskType;
    }

    public bool ShouldSerializeDescribe()
    {
      return __isset.Describe;
    }

    public bool ShouldSerializeTaskNum()
    {
      return __isset.TaskNum;
    }

    public bool ShouldSerializeRewardID()
    {
      return __isset.RewardID;
    }

    public bool ShouldSerializeRewardCnt()
    {
      return __isset.RewardCnt;
    }

    public bool ShouldSerializeActive()
    {
      return __isset.Active;
    }

    #endregion XmlSerializer support

    public DailyTaskConfigItem()
    {
    }

    public DailyTaskConfigItem DeepCopy()
    {
      var tmp0 = new DailyTaskConfigItem();
      if(__isset.Id)
      {
        tmp0.Id = this.Id;
      }
      tmp0.__isset.Id = this.__isset.Id;
      if(__isset.TaskPoolId)
      {
        tmp0.TaskPoolId = this.TaskPoolId;
      }
      tmp0.__isset.TaskPoolId = this.__isset.TaskPoolId;
      if((OpenCondition != null) && __isset.OpenCondition)
      {
        tmp0.OpenCondition = this.OpenCondition;
      }
      tmp0.__isset.OpenCondition = this.__isset.OpenCondition;
      if(__isset.TaskType)
      {
        tmp0.TaskType = this.TaskType;
      }
      tmp0.__isset.TaskType = this.__isset.TaskType;
      if((Describe != null) && __isset.Describe)
      {
        tmp0.Describe = this.Describe;
      }
      tmp0.__isset.Describe = this.__isset.Describe;
      if(__isset.TaskNum)
      {
        tmp0.TaskNum = this.TaskNum;
      }
      tmp0.__isset.TaskNum = this.__isset.TaskNum;
      if((RewardID != null) && __isset.RewardID)
      {
        tmp0.RewardID = this.RewardID;
      }
      tmp0.__isset.RewardID = this.__isset.RewardID;
      if((RewardCnt != null) && __isset.RewardCnt)
      {
        tmp0.RewardCnt = this.RewardCnt;
      }
      tmp0.__isset.RewardCnt = this.__isset.RewardCnt;
      if(__isset.Active)
      {
        tmp0.Active = this.Active;
      }
      tmp0.__isset.Active = this.__isset.Active;
      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)
              {
                TaskPoolId = await iprot.ReadI32Async(cancellationToken);
              }
              else
              {
                await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken);
              }
              break;
            case 3:
              if (field.Type == TType.String)
              {
                OpenCondition = await iprot.ReadStringAsync(cancellationToken);
              }
              else
              {
                await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken);
              }
              break;
            case 4:
              if (field.Type == TType.I32)
              {
                TaskType = await iprot.ReadI32Async(cancellationToken);
              }
              else
              {
                await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken);
              }
              break;
            case 5:
              if (field.Type == TType.String)
              {
                Describe = await iprot.ReadStringAsync(cancellationToken);
              }
              else
              {
                await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken);
              }
              break;
            case 6:
              if (field.Type == TType.I32)
              {
                TaskNum = await iprot.ReadI32Async(cancellationToken);
              }
              else
              {
                await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken);
              }
              break;
            case 7:
              if (field.Type == TType.String)
              {
                RewardID = await iprot.ReadStringAsync(cancellationToken);
              }
              else
              {
                await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken);
              }
              break;
            case 8:
              if (field.Type == TType.String)
              {
                RewardCnt = await iprot.ReadStringAsync(cancellationToken);
              }
              else
              {
                await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken);
              }
              break;
            case 9:
              if (field.Type == TType.I32)
              {
                Active = 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("DailyTaskConfigItem");
        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.TaskPoolId)
        {
          tmp2.Name = "TaskPoolId";
          tmp2.Type = TType.I32;
          tmp2.ID = 2;
          await oprot.WriteFieldBeginAsync(tmp2, cancellationToken);
          await oprot.WriteI32Async(TaskPoolId, cancellationToken);
          await oprot.WriteFieldEndAsync(cancellationToken);
        }
        if((OpenCondition != null) && __isset.OpenCondition)
        {
          tmp2.Name = "OpenCondition";
          tmp2.Type = TType.String;
          tmp2.ID = 3;
          await oprot.WriteFieldBeginAsync(tmp2, cancellationToken);
          await oprot.WriteStringAsync(OpenCondition, cancellationToken);
          await oprot.WriteFieldEndAsync(cancellationToken);
        }
        if(__isset.TaskType)
        {
          tmp2.Name = "TaskType";
          tmp2.Type = TType.I32;
          tmp2.ID = 4;
          await oprot.WriteFieldBeginAsync(tmp2, cancellationToken);
          await oprot.WriteI32Async(TaskType, cancellationToken);
          await oprot.WriteFieldEndAsync(cancellationToken);
        }
        if((Describe != null) && __isset.Describe)
        {
          tmp2.Name = "Describe";
          tmp2.Type = TType.String;
          tmp2.ID = 5;
          await oprot.WriteFieldBeginAsync(tmp2, cancellationToken);
          await oprot.WriteStringAsync(Describe, cancellationToken);
          await oprot.WriteFieldEndAsync(cancellationToken);
        }
        if(__isset.TaskNum)
        {
          tmp2.Name = "TaskNum";
          tmp2.Type = TType.I32;
          tmp2.ID = 6;
          await oprot.WriteFieldBeginAsync(tmp2, cancellationToken);
          await oprot.WriteI32Async(TaskNum, cancellationToken);
          await oprot.WriteFieldEndAsync(cancellationToken);
        }
        if((RewardID != null) && __isset.RewardID)
        {
          tmp2.Name = "RewardID";
          tmp2.Type = TType.String;
          tmp2.ID = 7;
          await oprot.WriteFieldBeginAsync(tmp2, cancellationToken);
          await oprot.WriteStringAsync(RewardID, cancellationToken);
          await oprot.WriteFieldEndAsync(cancellationToken);
        }
        if((RewardCnt != null) && __isset.RewardCnt)
        {
          tmp2.Name = "RewardCnt";
          tmp2.Type = TType.String;
          tmp2.ID = 8;
          await oprot.WriteFieldBeginAsync(tmp2, cancellationToken);
          await oprot.WriteStringAsync(RewardCnt, cancellationToken);
          await oprot.WriteFieldEndAsync(cancellationToken);
        }
        if(__isset.Active)
        {
          tmp2.Name = "Active";
          tmp2.Type = TType.I32;
          tmp2.ID = 9;
          await oprot.WriteFieldBeginAsync(tmp2, cancellationToken);
          await oprot.WriteI32Async(Active, 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 DailyTaskConfigItem 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.TaskPoolId == other.__isset.TaskPoolId) && ((!__isset.TaskPoolId) || (global::System.Object.Equals(TaskPoolId, other.TaskPoolId))))
        && ((__isset.OpenCondition == other.__isset.OpenCondition) && ((!__isset.OpenCondition) || (global::System.Object.Equals(OpenCondition, other.OpenCondition))))
        && ((__isset.TaskType == other.__isset.TaskType) && ((!__isset.TaskType) || (global::System.Object.Equals(TaskType, other.TaskType))))
        && ((__isset.Describe == other.__isset.Describe) && ((!__isset.Describe) || (global::System.Object.Equals(Describe, other.Describe))))
        && ((__isset.TaskNum == other.__isset.TaskNum) && ((!__isset.TaskNum) || (global::System.Object.Equals(TaskNum, other.TaskNum))))
        && ((__isset.RewardID == other.__isset.RewardID) && ((!__isset.RewardID) || (global::System.Object.Equals(RewardID, other.RewardID))))
        && ((__isset.RewardCnt == other.__isset.RewardCnt) && ((!__isset.RewardCnt) || (global::System.Object.Equals(RewardCnt, other.RewardCnt))))
        && ((__isset.Active == other.__isset.Active) && ((!__isset.Active) || (global::System.Object.Equals(Active, other.Active))));
    }

    public override int GetHashCode() {
      int hashcode = 157;
      unchecked {
        if(__isset.Id)
        {
          hashcode = (hashcode * 397) + Id.GetHashCode();
        }
        if(__isset.TaskPoolId)
        {
          hashcode = (hashcode * 397) + TaskPoolId.GetHashCode();
        }
        if((OpenCondition != null) && __isset.OpenCondition)
        {
          hashcode = (hashcode * 397) + OpenCondition.GetHashCode();
        }
        if(__isset.TaskType)
        {
          hashcode = (hashcode * 397) + TaskType.GetHashCode();
        }
        if((Describe != null) && __isset.Describe)
        {
          hashcode = (hashcode * 397) + Describe.GetHashCode();
        }
        if(__isset.TaskNum)
        {
          hashcode = (hashcode * 397) + TaskNum.GetHashCode();
        }
        if((RewardID != null) && __isset.RewardID)
        {
          hashcode = (hashcode * 397) + RewardID.GetHashCode();
        }
        if((RewardCnt != null) && __isset.RewardCnt)
        {
          hashcode = (hashcode * 397) + RewardCnt.GetHashCode();
        }
        if(__isset.Active)
        {
          hashcode = (hashcode * 397) + Active.GetHashCode();
        }
      }
      return hashcode;
    }

    public override string ToString()
    {
      var tmp3 = new StringBuilder("DailyTaskConfigItem(");
      int tmp4 = 0;
      if(__isset.Id)
      {
        if(0 < tmp4++) { tmp3.Append(", "); }
        tmp3.Append("Id: ");
        Id.ToString(tmp3);
      }
      if(__isset.TaskPoolId)
      {
        if(0 < tmp4++) { tmp3.Append(", "); }
        tmp3.Append("TaskPoolId: ");
        TaskPoolId.ToString(tmp3);
      }
      if((OpenCondition != null) && __isset.OpenCondition)
      {
        if(0 < tmp4++) { tmp3.Append(", "); }
        tmp3.Append("OpenCondition: ");
        OpenCondition.ToString(tmp3);
      }
      if(__isset.TaskType)
      {
        if(0 < tmp4++) { tmp3.Append(", "); }
        tmp3.Append("TaskType: ");
        TaskType.ToString(tmp3);
      }
      if((Describe != null) && __isset.Describe)
      {
        if(0 < tmp4++) { tmp3.Append(", "); }
        tmp3.Append("Describe: ");
        Describe.ToString(tmp3);
      }
      if(__isset.TaskNum)
      {
        if(0 < tmp4++) { tmp3.Append(", "); }
        tmp3.Append("TaskNum: ");
        TaskNum.ToString(tmp3);
      }
      if((RewardID != null) && __isset.RewardID)
      {
        if(0 < tmp4++) { tmp3.Append(", "); }
        tmp3.Append("RewardID: ");
        RewardID.ToString(tmp3);
      }
      if((RewardCnt != null) && __isset.RewardCnt)
      {
        if(0 < tmp4++) { tmp3.Append(", "); }
        tmp3.Append("RewardCnt: ");
        RewardCnt.ToString(tmp3);
      }
      if(__isset.Active)
      {
        if(0 < tmp4++) { tmp3.Append(", "); }
        tmp3.Append("Active: ");
        Active.ToString(tmp3);
      }
      tmp3.Append(')');
      return tmp3.ToString();
    }
  }

}
