/**
 * <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 MapBuildingItem : TBase
  {
    private int _Id;
    private int _Area;
    private int _Building;
    private int _BuildingUnlockLv;
    private int _BuildNum;
    private int _BuildLv;
    private int _EXPReward;
    private string _ProducerReward;
    private int _Parts;
    private string _PetCoins;
    private string _FogCover;
    private string _BuildingIcon;

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

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

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

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

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

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

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

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

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

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

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

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


    [DataMember(Order = 1)]
    public Isset __isset;
    [DataContract]
    public struct Isset
    {
      [DataMember]
      public bool Id;
      [DataMember]
      public bool Area;
      [DataMember]
      public bool Building;
      [DataMember]
      public bool BuildingUnlockLv;
      [DataMember]
      public bool BuildNum;
      [DataMember]
      public bool BuildLv;
      [DataMember]
      public bool EXPReward;
      [DataMember]
      public bool ProducerReward;
      [DataMember]
      public bool Parts;
      [DataMember]
      public bool PetCoins;
      [DataMember]
      public bool FogCover;
      [DataMember]
      public bool BuildingIcon;
    }

    #region XmlSerializer support

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

    public bool ShouldSerializeArea()
    {
      return __isset.Area;
    }

    public bool ShouldSerializeBuilding()
    {
      return __isset.Building;
    }

    public bool ShouldSerializeBuildingUnlockLv()
    {
      return __isset.BuildingUnlockLv;
    }

    public bool ShouldSerializeBuildNum()
    {
      return __isset.BuildNum;
    }

    public bool ShouldSerializeBuildLv()
    {
      return __isset.BuildLv;
    }

    public bool ShouldSerializeEXPReward()
    {
      return __isset.EXPReward;
    }

    public bool ShouldSerializeProducerReward()
    {
      return __isset.ProducerReward;
    }

    public bool ShouldSerializeParts()
    {
      return __isset.Parts;
    }

    public bool ShouldSerializePetCoins()
    {
      return __isset.PetCoins;
    }

    public bool ShouldSerializeFogCover()
    {
      return __isset.FogCover;
    }

    public bool ShouldSerializeBuildingIcon()
    {
      return __isset.BuildingIcon;
    }

    #endregion XmlSerializer support

    public MapBuildingItem()
    {
    }

    public MapBuildingItem DeepCopy()
    {
      var tmp0 = new MapBuildingItem();
      if(__isset.Id)
      {
        tmp0.Id = this.Id;
      }
      tmp0.__isset.Id = this.__isset.Id;
      if(__isset.Area)
      {
        tmp0.Area = this.Area;
      }
      tmp0.__isset.Area = this.__isset.Area;
      if(__isset.Building)
      {
        tmp0.Building = this.Building;
      }
      tmp0.__isset.Building = this.__isset.Building;
      if(__isset.BuildingUnlockLv)
      {
        tmp0.BuildingUnlockLv = this.BuildingUnlockLv;
      }
      tmp0.__isset.BuildingUnlockLv = this.__isset.BuildingUnlockLv;
      if(__isset.BuildNum)
      {
        tmp0.BuildNum = this.BuildNum;
      }
      tmp0.__isset.BuildNum = this.__isset.BuildNum;
      if(__isset.BuildLv)
      {
        tmp0.BuildLv = this.BuildLv;
      }
      tmp0.__isset.BuildLv = this.__isset.BuildLv;
      if(__isset.EXPReward)
      {
        tmp0.EXPReward = this.EXPReward;
      }
      tmp0.__isset.EXPReward = this.__isset.EXPReward;
      if((ProducerReward != null) && __isset.ProducerReward)
      {
        tmp0.ProducerReward = this.ProducerReward;
      }
      tmp0.__isset.ProducerReward = this.__isset.ProducerReward;
      if(__isset.Parts)
      {
        tmp0.Parts = this.Parts;
      }
      tmp0.__isset.Parts = this.__isset.Parts;
      if((PetCoins != null) && __isset.PetCoins)
      {
        tmp0.PetCoins = this.PetCoins;
      }
      tmp0.__isset.PetCoins = this.__isset.PetCoins;
      if((FogCover != null) && __isset.FogCover)
      {
        tmp0.FogCover = this.FogCover;
      }
      tmp0.__isset.FogCover = this.__isset.FogCover;
      if((BuildingIcon != null) && __isset.BuildingIcon)
      {
        tmp0.BuildingIcon = this.BuildingIcon;
      }
      tmp0.__isset.BuildingIcon = this.__isset.BuildingIcon;
      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)
              {
                Area = await iprot.ReadI32Async(cancellationToken);
              }
              else
              {
                await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken);
              }
              break;
            case 3:
              if (field.Type == TType.I32)
              {
                Building = await iprot.ReadI32Async(cancellationToken);
              }
              else
              {
                await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken);
              }
              break;
            case 4:
              if (field.Type == TType.I32)
              {
                BuildingUnlockLv = await iprot.ReadI32Async(cancellationToken);
              }
              else
              {
                await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken);
              }
              break;
            case 5:
              if (field.Type == TType.I32)
              {
                BuildNum = await iprot.ReadI32Async(cancellationToken);
              }
              else
              {
                await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken);
              }
              break;
            case 6:
              if (field.Type == TType.I32)
              {
                BuildLv = await iprot.ReadI32Async(cancellationToken);
              }
              else
              {
                await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken);
              }
              break;
            case 7:
              if (field.Type == TType.I32)
              {
                EXPReward = await iprot.ReadI32Async(cancellationToken);
              }
              else
              {
                await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken);
              }
              break;
            case 8:
              if (field.Type == TType.String)
              {
                ProducerReward = await iprot.ReadStringAsync(cancellationToken);
              }
              else
              {
                await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken);
              }
              break;
            case 9:
              if (field.Type == TType.I32)
              {
                Parts = await iprot.ReadI32Async(cancellationToken);
              }
              else
              {
                await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken);
              }
              break;
            case 10:
              if (field.Type == TType.String)
              {
                PetCoins = await iprot.ReadStringAsync(cancellationToken);
              }
              else
              {
                await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken);
              }
              break;
            case 11:
              if (field.Type == TType.String)
              {
                FogCover = await iprot.ReadStringAsync(cancellationToken);
              }
              else
              {
                await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken);
              }
              break;
            case 12:
              if (field.Type == TType.String)
              {
                BuildingIcon = 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("MapBuildingItem");
        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.Area)
        {
          tmp2.Name = "Area";
          tmp2.Type = TType.I32;
          tmp2.ID = 2;
          await oprot.WriteFieldBeginAsync(tmp2, cancellationToken);
          await oprot.WriteI32Async(Area, cancellationToken);
          await oprot.WriteFieldEndAsync(cancellationToken);
        }
        if(__isset.Building)
        {
          tmp2.Name = "Building";
          tmp2.Type = TType.I32;
          tmp2.ID = 3;
          await oprot.WriteFieldBeginAsync(tmp2, cancellationToken);
          await oprot.WriteI32Async(Building, cancellationToken);
          await oprot.WriteFieldEndAsync(cancellationToken);
        }
        if(__isset.BuildingUnlockLv)
        {
          tmp2.Name = "BuildingUnlockLv";
          tmp2.Type = TType.I32;
          tmp2.ID = 4;
          await oprot.WriteFieldBeginAsync(tmp2, cancellationToken);
          await oprot.WriteI32Async(BuildingUnlockLv, cancellationToken);
          await oprot.WriteFieldEndAsync(cancellationToken);
        }
        if(__isset.BuildNum)
        {
          tmp2.Name = "BuildNum";
          tmp2.Type = TType.I32;
          tmp2.ID = 5;
          await oprot.WriteFieldBeginAsync(tmp2, cancellationToken);
          await oprot.WriteI32Async(BuildNum, cancellationToken);
          await oprot.WriteFieldEndAsync(cancellationToken);
        }
        if(__isset.BuildLv)
        {
          tmp2.Name = "BuildLv";
          tmp2.Type = TType.I32;
          tmp2.ID = 6;
          await oprot.WriteFieldBeginAsync(tmp2, cancellationToken);
          await oprot.WriteI32Async(BuildLv, cancellationToken);
          await oprot.WriteFieldEndAsync(cancellationToken);
        }
        if(__isset.EXPReward)
        {
          tmp2.Name = "EXPReward";
          tmp2.Type = TType.I32;
          tmp2.ID = 7;
          await oprot.WriteFieldBeginAsync(tmp2, cancellationToken);
          await oprot.WriteI32Async(EXPReward, cancellationToken);
          await oprot.WriteFieldEndAsync(cancellationToken);
        }
        if((ProducerReward != null) && __isset.ProducerReward)
        {
          tmp2.Name = "ProducerReward";
          tmp2.Type = TType.String;
          tmp2.ID = 8;
          await oprot.WriteFieldBeginAsync(tmp2, cancellationToken);
          await oprot.WriteStringAsync(ProducerReward, cancellationToken);
          await oprot.WriteFieldEndAsync(cancellationToken);
        }
        if(__isset.Parts)
        {
          tmp2.Name = "Parts";
          tmp2.Type = TType.I32;
          tmp2.ID = 9;
          await oprot.WriteFieldBeginAsync(tmp2, cancellationToken);
          await oprot.WriteI32Async(Parts, cancellationToken);
          await oprot.WriteFieldEndAsync(cancellationToken);
        }
        if((PetCoins != null) && __isset.PetCoins)
        {
          tmp2.Name = "PetCoins";
          tmp2.Type = TType.String;
          tmp2.ID = 10;
          await oprot.WriteFieldBeginAsync(tmp2, cancellationToken);
          await oprot.WriteStringAsync(PetCoins, cancellationToken);
          await oprot.WriteFieldEndAsync(cancellationToken);
        }
        if((FogCover != null) && __isset.FogCover)
        {
          tmp2.Name = "FogCover";
          tmp2.Type = TType.String;
          tmp2.ID = 11;
          await oprot.WriteFieldBeginAsync(tmp2, cancellationToken);
          await oprot.WriteStringAsync(FogCover, cancellationToken);
          await oprot.WriteFieldEndAsync(cancellationToken);
        }
        if((BuildingIcon != null) && __isset.BuildingIcon)
        {
          tmp2.Name = "BuildingIcon";
          tmp2.Type = TType.String;
          tmp2.ID = 12;
          await oprot.WriteFieldBeginAsync(tmp2, cancellationToken);
          await oprot.WriteStringAsync(BuildingIcon, 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 MapBuildingItem 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.Area == other.__isset.Area) && ((!__isset.Area) || (global::System.Object.Equals(Area, other.Area))))
        && ((__isset.Building == other.__isset.Building) && ((!__isset.Building) || (global::System.Object.Equals(Building, other.Building))))
        && ((__isset.BuildingUnlockLv == other.__isset.BuildingUnlockLv) && ((!__isset.BuildingUnlockLv) || (global::System.Object.Equals(BuildingUnlockLv, other.BuildingUnlockLv))))
        && ((__isset.BuildNum == other.__isset.BuildNum) && ((!__isset.BuildNum) || (global::System.Object.Equals(BuildNum, other.BuildNum))))
        && ((__isset.BuildLv == other.__isset.BuildLv) && ((!__isset.BuildLv) || (global::System.Object.Equals(BuildLv, other.BuildLv))))
        && ((__isset.EXPReward == other.__isset.EXPReward) && ((!__isset.EXPReward) || (global::System.Object.Equals(EXPReward, other.EXPReward))))
        && ((__isset.ProducerReward == other.__isset.ProducerReward) && ((!__isset.ProducerReward) || (global::System.Object.Equals(ProducerReward, other.ProducerReward))))
        && ((__isset.Parts == other.__isset.Parts) && ((!__isset.Parts) || (global::System.Object.Equals(Parts, other.Parts))))
        && ((__isset.PetCoins == other.__isset.PetCoins) && ((!__isset.PetCoins) || (global::System.Object.Equals(PetCoins, other.PetCoins))))
        && ((__isset.FogCover == other.__isset.FogCover) && ((!__isset.FogCover) || (global::System.Object.Equals(FogCover, other.FogCover))))
        && ((__isset.BuildingIcon == other.__isset.BuildingIcon) && ((!__isset.BuildingIcon) || (global::System.Object.Equals(BuildingIcon, other.BuildingIcon))));
    }

    public override int GetHashCode() {
      int hashcode = 157;
      unchecked {
        if(__isset.Id)
        {
          hashcode = (hashcode * 397) + Id.GetHashCode();
        }
        if(__isset.Area)
        {
          hashcode = (hashcode * 397) + Area.GetHashCode();
        }
        if(__isset.Building)
        {
          hashcode = (hashcode * 397) + Building.GetHashCode();
        }
        if(__isset.BuildingUnlockLv)
        {
          hashcode = (hashcode * 397) + BuildingUnlockLv.GetHashCode();
        }
        if(__isset.BuildNum)
        {
          hashcode = (hashcode * 397) + BuildNum.GetHashCode();
        }
        if(__isset.BuildLv)
        {
          hashcode = (hashcode * 397) + BuildLv.GetHashCode();
        }
        if(__isset.EXPReward)
        {
          hashcode = (hashcode * 397) + EXPReward.GetHashCode();
        }
        if((ProducerReward != null) && __isset.ProducerReward)
        {
          hashcode = (hashcode * 397) + ProducerReward.GetHashCode();
        }
        if(__isset.Parts)
        {
          hashcode = (hashcode * 397) + Parts.GetHashCode();
        }
        if((PetCoins != null) && __isset.PetCoins)
        {
          hashcode = (hashcode * 397) + PetCoins.GetHashCode();
        }
        if((FogCover != null) && __isset.FogCover)
        {
          hashcode = (hashcode * 397) + FogCover.GetHashCode();
        }
        if((BuildingIcon != null) && __isset.BuildingIcon)
        {
          hashcode = (hashcode * 397) + BuildingIcon.GetHashCode();
        }
      }
      return hashcode;
    }

    public override string ToString()
    {
      var tmp3 = new StringBuilder("MapBuildingItem(");
      int tmp4 = 0;
      if(__isset.Id)
      {
        if(0 < tmp4++) { tmp3.Append(", "); }
        tmp3.Append("Id: ");
        Id.ToString(tmp3);
      }
      if(__isset.Area)
      {
        if(0 < tmp4++) { tmp3.Append(", "); }
        tmp3.Append("Area: ");
        Area.ToString(tmp3);
      }
      if(__isset.Building)
      {
        if(0 < tmp4++) { tmp3.Append(", "); }
        tmp3.Append("Building: ");
        Building.ToString(tmp3);
      }
      if(__isset.BuildingUnlockLv)
      {
        if(0 < tmp4++) { tmp3.Append(", "); }
        tmp3.Append("BuildingUnlockLv: ");
        BuildingUnlockLv.ToString(tmp3);
      }
      if(__isset.BuildNum)
      {
        if(0 < tmp4++) { tmp3.Append(", "); }
        tmp3.Append("BuildNum: ");
        BuildNum.ToString(tmp3);
      }
      if(__isset.BuildLv)
      {
        if(0 < tmp4++) { tmp3.Append(", "); }
        tmp3.Append("BuildLv: ");
        BuildLv.ToString(tmp3);
      }
      if(__isset.EXPReward)
      {
        if(0 < tmp4++) { tmp3.Append(", "); }
        tmp3.Append("EXPReward: ");
        EXPReward.ToString(tmp3);
      }
      if((ProducerReward != null) && __isset.ProducerReward)
      {
        if(0 < tmp4++) { tmp3.Append(", "); }
        tmp3.Append("ProducerReward: ");
        ProducerReward.ToString(tmp3);
      }
      if(__isset.Parts)
      {
        if(0 < tmp4++) { tmp3.Append(", "); }
        tmp3.Append("Parts: ");
        Parts.ToString(tmp3);
      }
      if((PetCoins != null) && __isset.PetCoins)
      {
        if(0 < tmp4++) { tmp3.Append(", "); }
        tmp3.Append("PetCoins: ");
        PetCoins.ToString(tmp3);
      }
      if((FogCover != null) && __isset.FogCover)
      {
        if(0 < tmp4++) { tmp3.Append(", "); }
        tmp3.Append("FogCover: ");
        FogCover.ToString(tmp3);
      }
      if((BuildingIcon != null) && __isset.BuildingIcon)
      {
        if(0 < tmp4++) { tmp3.Append(", "); }
        tmp3.Append("BuildingIcon: ");
        BuildingIcon.ToString(tmp3);
      }
      tmp3.Append(')');
      return tmp3.ToString();
    }
  }

}
