/**
 * Autogenerated by Thrift Compiler (0.14.0)
 *
 * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
 *  @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 Microsoft.Extensions.Logging;
using Thrift;
using Thrift.Collections;
using System.ServiceModel;
using System.Runtime.Serialization;

using Thrift.Protocol;
using Thrift.Protocol.Entities;
using Thrift.Protocol.Utilities;
using Thrift.Transport;
using Thrift.Transport.Client;
using Thrift.Transport.Server;
using Thrift.Processor;


#pragma warning disable IDE0079  // remove unnecessary pragmas
#pragma warning disable IDE1006  // parts of the code use IDL spelling

namespace Apache.Cassandra.Test
{

  [DataContract(Namespace="")]
  public partial class CfDef : TBase
  {
    private string _column_type;
    private string _comparator_type;
    private string _subcomparator_type;
    private string _comment;
    private double _read_repair_chance;
    private List<global::Apache.Cassandra.Test.ColumnDef> _column_metadata;
    private int _gc_grace_seconds;
    private string _default_validation_class;
    private int _id;
    private int _min_compaction_threshold;
    private int _max_compaction_threshold;
    private bool _replicate_on_write;
    private double _merge_shards_chance;
    private string _key_validation_class;
    private byte[] _key_alias;
    private string _compaction_strategy;
    private Dictionary<string, string> _compaction_strategy_options;
    private Dictionary<string, string> _compression_options;
    private double _bloom_filter_fp_chance;

    [DataMember(Order = 0)]
    public string Keyspace { get; set; }

    [DataMember(Order = 0)]
    public string Name { get; set; }

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

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

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

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

    [DataMember(Order = 0)]
    public double Read_repair_chance
    {
      get
      {
        return _read_repair_chance;
      }
      set
      {
        __isset.read_repair_chance = true;
        this._read_repair_chance = value;
      }
    }

    [DataMember(Order = 0)]
    public List<global::Apache.Cassandra.Test.ColumnDef> Column_metadata
    {
      get
      {
        return _column_metadata;
      }
      set
      {
        __isset.column_metadata = true;
        this._column_metadata = value;
      }
    }

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

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

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

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

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

    [DataMember(Order = 0)]
    public bool Replicate_on_write
    {
      get
      {
        return _replicate_on_write;
      }
      set
      {
        __isset.replicate_on_write = true;
        this._replicate_on_write = value;
      }
    }

    [DataMember(Order = 0)]
    public double Merge_shards_chance
    {
      get
      {
        return _merge_shards_chance;
      }
      set
      {
        __isset.merge_shards_chance = true;
        this._merge_shards_chance = value;
      }
    }

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

    [DataMember(Order = 0)]
    public byte[] Key_alias
    {
      get
      {
        return _key_alias;
      }
      set
      {
        __isset.key_alias = true;
        this._key_alias = value;
      }
    }

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

    [DataMember(Order = 0)]
    public Dictionary<string, string> Compaction_strategy_options
    {
      get
      {
        return _compaction_strategy_options;
      }
      set
      {
        __isset.compaction_strategy_options = true;
        this._compaction_strategy_options = value;
      }
    }

    [DataMember(Order = 0)]
    public Dictionary<string, string> Compression_options
    {
      get
      {
        return _compression_options;
      }
      set
      {
        __isset.compression_options = true;
        this._compression_options = value;
      }
    }

    [DataMember(Order = 0)]
    public double Bloom_filter_fp_chance
    {
      get
      {
        return _bloom_filter_fp_chance;
      }
      set
      {
        __isset.bloom_filter_fp_chance = true;
        this._bloom_filter_fp_chance = value;
      }
    }


    [DataMember(Order = 1)]
    public Isset __isset;
    [DataContract]
    public struct Isset
    {
      [DataMember]
      public bool column_type;
      [DataMember]
      public bool comparator_type;
      [DataMember]
      public bool subcomparator_type;
      [DataMember]
      public bool comment;
      [DataMember]
      public bool read_repair_chance;
      [DataMember]
      public bool column_metadata;
      [DataMember]
      public bool gc_grace_seconds;
      [DataMember]
      public bool default_validation_class;
      [DataMember]
      public bool id;
      [DataMember]
      public bool min_compaction_threshold;
      [DataMember]
      public bool max_compaction_threshold;
      [DataMember]
      public bool replicate_on_write;
      [DataMember]
      public bool merge_shards_chance;
      [DataMember]
      public bool key_validation_class;
      [DataMember]
      public bool key_alias;
      [DataMember]
      public bool compaction_strategy;
      [DataMember]
      public bool compaction_strategy_options;
      [DataMember]
      public bool compression_options;
      [DataMember]
      public bool bloom_filter_fp_chance;
    }

    #region XmlSerializer support

    public bool ShouldSerializeColumn_type()
    {
      return __isset.column_type;
    }

    public bool ShouldSerializeComparator_type()
    {
      return __isset.comparator_type;
    }

    public bool ShouldSerializeSubcomparator_type()
    {
      return __isset.subcomparator_type;
    }

    public bool ShouldSerializeComment()
    {
      return __isset.comment;
    }

    public bool ShouldSerializeRead_repair_chance()
    {
      return __isset.read_repair_chance;
    }

    public bool ShouldSerializeColumn_metadata()
    {
      return __isset.column_metadata;
    }

    public bool ShouldSerializeGc_grace_seconds()
    {
      return __isset.gc_grace_seconds;
    }

    public bool ShouldSerializeDefault_validation_class()
    {
      return __isset.default_validation_class;
    }

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

    public bool ShouldSerializeMin_compaction_threshold()
    {
      return __isset.min_compaction_threshold;
    }

    public bool ShouldSerializeMax_compaction_threshold()
    {
      return __isset.max_compaction_threshold;
    }

    public bool ShouldSerializeReplicate_on_write()
    {
      return __isset.replicate_on_write;
    }

    public bool ShouldSerializeMerge_shards_chance()
    {
      return __isset.merge_shards_chance;
    }

    public bool ShouldSerializeKey_validation_class()
    {
      return __isset.key_validation_class;
    }

    public bool ShouldSerializeKey_alias()
    {
      return __isset.key_alias;
    }

    public bool ShouldSerializeCompaction_strategy()
    {
      return __isset.compaction_strategy;
    }

    public bool ShouldSerializeCompaction_strategy_options()
    {
      return __isset.compaction_strategy_options;
    }

    public bool ShouldSerializeCompression_options()
    {
      return __isset.compression_options;
    }

    public bool ShouldSerializeBloom_filter_fp_chance()
    {
      return __isset.bloom_filter_fp_chance;
    }

    #endregion XmlSerializer support

    public CfDef()
    {
      this._column_type = "Standard";
      this.__isset.column_type = true;
      this._comparator_type = "BytesType";
      this.__isset.comparator_type = true;
      this._read_repair_chance = 1;
      this.__isset.read_repair_chance = true;
    }

    public CfDef(string keyspace, string name) : this()
    {
      this.Keyspace = keyspace;
      this.Name = name;
    }

    public CfDef DeepCopy()
    {
      var tmp96 = new CfDef();
      if((Keyspace != null))
      {
        tmp96.Keyspace = this.Keyspace;
      }
      if((Name != null))
      {
        tmp96.Name = this.Name;
      }
      if((Column_type != null) && __isset.column_type)
      {
        tmp96.Column_type = this.Column_type;
      }
      tmp96.__isset.column_type = this.__isset.column_type;
      if((Comparator_type != null) && __isset.comparator_type)
      {
        tmp96.Comparator_type = this.Comparator_type;
      }
      tmp96.__isset.comparator_type = this.__isset.comparator_type;
      if((Subcomparator_type != null) && __isset.subcomparator_type)
      {
        tmp96.Subcomparator_type = this.Subcomparator_type;
      }
      tmp96.__isset.subcomparator_type = this.__isset.subcomparator_type;
      if((Comment != null) && __isset.comment)
      {
        tmp96.Comment = this.Comment;
      }
      tmp96.__isset.comment = this.__isset.comment;
      if(__isset.read_repair_chance)
      {
        tmp96.Read_repair_chance = this.Read_repair_chance;
      }
      tmp96.__isset.read_repair_chance = this.__isset.read_repair_chance;
      if((Column_metadata != null) && __isset.column_metadata)
      {
        tmp96.Column_metadata = this.Column_metadata.DeepCopy();
      }
      tmp96.__isset.column_metadata = this.__isset.column_metadata;
      if(__isset.gc_grace_seconds)
      {
        tmp96.Gc_grace_seconds = this.Gc_grace_seconds;
      }
      tmp96.__isset.gc_grace_seconds = this.__isset.gc_grace_seconds;
      if((Default_validation_class != null) && __isset.default_validation_class)
      {
        tmp96.Default_validation_class = this.Default_validation_class;
      }
      tmp96.__isset.default_validation_class = this.__isset.default_validation_class;
      if(__isset.id)
      {
        tmp96.Id = this.Id;
      }
      tmp96.__isset.id = this.__isset.id;
      if(__isset.min_compaction_threshold)
      {
        tmp96.Min_compaction_threshold = this.Min_compaction_threshold;
      }
      tmp96.__isset.min_compaction_threshold = this.__isset.min_compaction_threshold;
      if(__isset.max_compaction_threshold)
      {
        tmp96.Max_compaction_threshold = this.Max_compaction_threshold;
      }
      tmp96.__isset.max_compaction_threshold = this.__isset.max_compaction_threshold;
      if(__isset.replicate_on_write)
      {
        tmp96.Replicate_on_write = this.Replicate_on_write;
      }
      tmp96.__isset.replicate_on_write = this.__isset.replicate_on_write;
      if(__isset.merge_shards_chance)
      {
        tmp96.Merge_shards_chance = this.Merge_shards_chance;
      }
      tmp96.__isset.merge_shards_chance = this.__isset.merge_shards_chance;
      if((Key_validation_class != null) && __isset.key_validation_class)
      {
        tmp96.Key_validation_class = this.Key_validation_class;
      }
      tmp96.__isset.key_validation_class = this.__isset.key_validation_class;
      if((Key_alias != null) && __isset.key_alias)
      {
        tmp96.Key_alias = this.Key_alias.ToArray();
      }
      tmp96.__isset.key_alias = this.__isset.key_alias;
      if((Compaction_strategy != null) && __isset.compaction_strategy)
      {
        tmp96.Compaction_strategy = this.Compaction_strategy;
      }
      tmp96.__isset.compaction_strategy = this.__isset.compaction_strategy;
      if((Compaction_strategy_options != null) && __isset.compaction_strategy_options)
      {
        tmp96.Compaction_strategy_options = this.Compaction_strategy_options.DeepCopy();
      }
      tmp96.__isset.compaction_strategy_options = this.__isset.compaction_strategy_options;
      if((Compression_options != null) && __isset.compression_options)
      {
        tmp96.Compression_options = this.Compression_options.DeepCopy();
      }
      tmp96.__isset.compression_options = this.__isset.compression_options;
      if(__isset.bloom_filter_fp_chance)
      {
        tmp96.Bloom_filter_fp_chance = this.Bloom_filter_fp_chance;
      }
      tmp96.__isset.bloom_filter_fp_chance = this.__isset.bloom_filter_fp_chance;
      return tmp96;
    }

    public async global::System.Threading.Tasks.Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken)
    {
      iprot.IncrementRecursionDepth();
      try
      {
        bool isset_keyspace = false;
        bool isset_name = false;
        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.String)
              {
                Keyspace = await iprot.ReadStringAsync(cancellationToken);
                isset_keyspace = true;
              }
              else
              {
                await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken);
              }
              break;
            case 2:
              if (field.Type == TType.String)
              {
                Name = await iprot.ReadStringAsync(cancellationToken);
                isset_name = true;
              }
              else
              {
                await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken);
              }
              break;
            case 3:
              if (field.Type == TType.String)
              {
                Column_type = await iprot.ReadStringAsync(cancellationToken);
              }
              else
              {
                await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken);
              }
              break;
            case 5:
              if (field.Type == TType.String)
              {
                Comparator_type = await iprot.ReadStringAsync(cancellationToken);
              }
              else
              {
                await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken);
              }
              break;
            case 6:
              if (field.Type == TType.String)
              {
                Subcomparator_type = await iprot.ReadStringAsync(cancellationToken);
              }
              else
              {
                await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken);
              }
              break;
            case 8:
              if (field.Type == TType.String)
              {
                Comment = await iprot.ReadStringAsync(cancellationToken);
              }
              else
              {
                await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken);
              }
              break;
            case 12:
              if (field.Type == TType.Double)
              {
                Read_repair_chance = await iprot.ReadDoubleAsync(cancellationToken);
              }
              else
              {
                await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken);
              }
              break;
            case 13:
              if (field.Type == TType.List)
              {
                {
                  TList _list97 = await iprot.ReadListBeginAsync(cancellationToken);
                  Column_metadata = new List<global::Apache.Cassandra.Test.ColumnDef>(_list97.Count);
                  for(int _i98 = 0; _i98 < _list97.Count; ++_i98)
                  {
                    global::Apache.Cassandra.Test.ColumnDef _elem99;
                    _elem99 = new global::Apache.Cassandra.Test.ColumnDef();
                    await _elem99.ReadAsync(iprot, cancellationToken);
                    Column_metadata.Add(_elem99);
                  }
                  await iprot.ReadListEndAsync(cancellationToken);
                }
              }
              else
              {
                await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken);
              }
              break;
            case 14:
              if (field.Type == TType.I32)
              {
                Gc_grace_seconds = await iprot.ReadI32Async(cancellationToken);
              }
              else
              {
                await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken);
              }
              break;
            case 15:
              if (field.Type == TType.String)
              {
                Default_validation_class = await iprot.ReadStringAsync(cancellationToken);
              }
              else
              {
                await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken);
              }
              break;
            case 16:
              if (field.Type == TType.I32)
              {
                Id = await iprot.ReadI32Async(cancellationToken);
              }
              else
              {
                await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken);
              }
              break;
            case 17:
              if (field.Type == TType.I32)
              {
                Min_compaction_threshold = await iprot.ReadI32Async(cancellationToken);
              }
              else
              {
                await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken);
              }
              break;
            case 18:
              if (field.Type == TType.I32)
              {
                Max_compaction_threshold = await iprot.ReadI32Async(cancellationToken);
              }
              else
              {
                await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken);
              }
              break;
            case 24:
              if (field.Type == TType.Bool)
              {
                Replicate_on_write = await iprot.ReadBoolAsync(cancellationToken);
              }
              else
              {
                await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken);
              }
              break;
            case 25:
              if (field.Type == TType.Double)
              {
                Merge_shards_chance = await iprot.ReadDoubleAsync(cancellationToken);
              }
              else
              {
                await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken);
              }
              break;
            case 26:
              if (field.Type == TType.String)
              {
                Key_validation_class = await iprot.ReadStringAsync(cancellationToken);
              }
              else
              {
                await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken);
              }
              break;
            case 28:
              if (field.Type == TType.String)
              {
                Key_alias = await iprot.ReadBinaryAsync(cancellationToken);
              }
              else
              {
                await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken);
              }
              break;
            case 29:
              if (field.Type == TType.String)
              {
                Compaction_strategy = await iprot.ReadStringAsync(cancellationToken);
              }
              else
              {
                await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken);
              }
              break;
            case 30:
              if (field.Type == TType.Map)
              {
                {
                  TMap _map100 = await iprot.ReadMapBeginAsync(cancellationToken);
                  Compaction_strategy_options = new Dictionary<string, string>(_map100.Count);
                  for(int _i101 = 0; _i101 < _map100.Count; ++_i101)
                  {
                    string _key102;
                    string _val103;
                    _key102 = await iprot.ReadStringAsync(cancellationToken);
                    _val103 = await iprot.ReadStringAsync(cancellationToken);
                    Compaction_strategy_options[_key102] = _val103;
                  }
                  await iprot.ReadMapEndAsync(cancellationToken);
                }
              }
              else
              {
                await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken);
              }
              break;
            case 32:
              if (field.Type == TType.Map)
              {
                {
                  TMap _map104 = await iprot.ReadMapBeginAsync(cancellationToken);
                  Compression_options = new Dictionary<string, string>(_map104.Count);
                  for(int _i105 = 0; _i105 < _map104.Count; ++_i105)
                  {
                    string _key106;
                    string _val107;
                    _key106 = await iprot.ReadStringAsync(cancellationToken);
                    _val107 = await iprot.ReadStringAsync(cancellationToken);
                    Compression_options[_key106] = _val107;
                  }
                  await iprot.ReadMapEndAsync(cancellationToken);
                }
              }
              else
              {
                await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken);
              }
              break;
            case 33:
              if (field.Type == TType.Double)
              {
                Bloom_filter_fp_chance = await iprot.ReadDoubleAsync(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);
        if (!isset_keyspace)
        {
          throw new TProtocolException(TProtocolException.INVALID_DATA);
        }
        if (!isset_name)
        {
          throw new TProtocolException(TProtocolException.INVALID_DATA);
        }
      }
      finally
      {
        iprot.DecrementRecursionDepth();
      }
    }

    public async global::System.Threading.Tasks.Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken)
    {
      oprot.IncrementRecursionDepth();
      try
      {
        var struc = new TStruct("CfDef");
        await oprot.WriteStructBeginAsync(struc, cancellationToken);
        var field = new TField();
        if((Keyspace != null))
        {
          field.Name = "keyspace";
          field.Type = TType.String;
          field.ID = 1;
          await oprot.WriteFieldBeginAsync(field, cancellationToken);
          await oprot.WriteStringAsync(Keyspace, cancellationToken);
          await oprot.WriteFieldEndAsync(cancellationToken);
        }
        if((Name != null))
        {
          field.Name = "name";
          field.Type = TType.String;
          field.ID = 2;
          await oprot.WriteFieldBeginAsync(field, cancellationToken);
          await oprot.WriteStringAsync(Name, cancellationToken);
          await oprot.WriteFieldEndAsync(cancellationToken);
        }
        if((Column_type != null) && __isset.column_type)
        {
          field.Name = "column_type";
          field.Type = TType.String;
          field.ID = 3;
          await oprot.WriteFieldBeginAsync(field, cancellationToken);
          await oprot.WriteStringAsync(Column_type, cancellationToken);
          await oprot.WriteFieldEndAsync(cancellationToken);
        }
        if((Comparator_type != null) && __isset.comparator_type)
        {
          field.Name = "comparator_type";
          field.Type = TType.String;
          field.ID = 5;
          await oprot.WriteFieldBeginAsync(field, cancellationToken);
          await oprot.WriteStringAsync(Comparator_type, cancellationToken);
          await oprot.WriteFieldEndAsync(cancellationToken);
        }
        if((Subcomparator_type != null) && __isset.subcomparator_type)
        {
          field.Name = "subcomparator_type";
          field.Type = TType.String;
          field.ID = 6;
          await oprot.WriteFieldBeginAsync(field, cancellationToken);
          await oprot.WriteStringAsync(Subcomparator_type, cancellationToken);
          await oprot.WriteFieldEndAsync(cancellationToken);
        }
        if((Comment != null) && __isset.comment)
        {
          field.Name = "comment";
          field.Type = TType.String;
          field.ID = 8;
          await oprot.WriteFieldBeginAsync(field, cancellationToken);
          await oprot.WriteStringAsync(Comment, cancellationToken);
          await oprot.WriteFieldEndAsync(cancellationToken);
        }
        if(__isset.read_repair_chance)
        {
          field.Name = "read_repair_chance";
          field.Type = TType.Double;
          field.ID = 12;
          await oprot.WriteFieldBeginAsync(field, cancellationToken);
          await oprot.WriteDoubleAsync(Read_repair_chance, cancellationToken);
          await oprot.WriteFieldEndAsync(cancellationToken);
        }
        if((Column_metadata != null) && __isset.column_metadata)
        {
          field.Name = "column_metadata";
          field.Type = TType.List;
          field.ID = 13;
          await oprot.WriteFieldBeginAsync(field, cancellationToken);
          {
            await oprot.WriteListBeginAsync(new TList(TType.Struct, Column_metadata.Count), cancellationToken);
            foreach (global::Apache.Cassandra.Test.ColumnDef _iter108 in Column_metadata)
            {
              await _iter108.WriteAsync(oprot, cancellationToken);
            }
            await oprot.WriteListEndAsync(cancellationToken);
          }
          await oprot.WriteFieldEndAsync(cancellationToken);
        }
        if(__isset.gc_grace_seconds)
        {
          field.Name = "gc_grace_seconds";
          field.Type = TType.I32;
          field.ID = 14;
          await oprot.WriteFieldBeginAsync(field, cancellationToken);
          await oprot.WriteI32Async(Gc_grace_seconds, cancellationToken);
          await oprot.WriteFieldEndAsync(cancellationToken);
        }
        if((Default_validation_class != null) && __isset.default_validation_class)
        {
          field.Name = "default_validation_class";
          field.Type = TType.String;
          field.ID = 15;
          await oprot.WriteFieldBeginAsync(field, cancellationToken);
          await oprot.WriteStringAsync(Default_validation_class, cancellationToken);
          await oprot.WriteFieldEndAsync(cancellationToken);
        }
        if(__isset.id)
        {
          field.Name = "id";
          field.Type = TType.I32;
          field.ID = 16;
          await oprot.WriteFieldBeginAsync(field, cancellationToken);
          await oprot.WriteI32Async(Id, cancellationToken);
          await oprot.WriteFieldEndAsync(cancellationToken);
        }
        if(__isset.min_compaction_threshold)
        {
          field.Name = "min_compaction_threshold";
          field.Type = TType.I32;
          field.ID = 17;
          await oprot.WriteFieldBeginAsync(field, cancellationToken);
          await oprot.WriteI32Async(Min_compaction_threshold, cancellationToken);
          await oprot.WriteFieldEndAsync(cancellationToken);
        }
        if(__isset.max_compaction_threshold)
        {
          field.Name = "max_compaction_threshold";
          field.Type = TType.I32;
          field.ID = 18;
          await oprot.WriteFieldBeginAsync(field, cancellationToken);
          await oprot.WriteI32Async(Max_compaction_threshold, cancellationToken);
          await oprot.WriteFieldEndAsync(cancellationToken);
        }
        if(__isset.replicate_on_write)
        {
          field.Name = "replicate_on_write";
          field.Type = TType.Bool;
          field.ID = 24;
          await oprot.WriteFieldBeginAsync(field, cancellationToken);
          await oprot.WriteBoolAsync(Replicate_on_write, cancellationToken);
          await oprot.WriteFieldEndAsync(cancellationToken);
        }
        if(__isset.merge_shards_chance)
        {
          field.Name = "merge_shards_chance";
          field.Type = TType.Double;
          field.ID = 25;
          await oprot.WriteFieldBeginAsync(field, cancellationToken);
          await oprot.WriteDoubleAsync(Merge_shards_chance, cancellationToken);
          await oprot.WriteFieldEndAsync(cancellationToken);
        }
        if((Key_validation_class != null) && __isset.key_validation_class)
        {
          field.Name = "key_validation_class";
          field.Type = TType.String;
          field.ID = 26;
          await oprot.WriteFieldBeginAsync(field, cancellationToken);
          await oprot.WriteStringAsync(Key_validation_class, cancellationToken);
          await oprot.WriteFieldEndAsync(cancellationToken);
        }
        if((Key_alias != null) && __isset.key_alias)
        {
          field.Name = "key_alias";
          field.Type = TType.String;
          field.ID = 28;
          await oprot.WriteFieldBeginAsync(field, cancellationToken);
          await oprot.WriteBinaryAsync(Key_alias, cancellationToken);
          await oprot.WriteFieldEndAsync(cancellationToken);
        }
        if((Compaction_strategy != null) && __isset.compaction_strategy)
        {
          field.Name = "compaction_strategy";
          field.Type = TType.String;
          field.ID = 29;
          await oprot.WriteFieldBeginAsync(field, cancellationToken);
          await oprot.WriteStringAsync(Compaction_strategy, cancellationToken);
          await oprot.WriteFieldEndAsync(cancellationToken);
        }
        if((Compaction_strategy_options != null) && __isset.compaction_strategy_options)
        {
          field.Name = "compaction_strategy_options";
          field.Type = TType.Map;
          field.ID = 30;
          await oprot.WriteFieldBeginAsync(field, cancellationToken);
          {
            await oprot.WriteMapBeginAsync(new TMap(TType.String, TType.String, Compaction_strategy_options.Count), cancellationToken);
            foreach (string _iter109 in Compaction_strategy_options.Keys)
            {
              await oprot.WriteStringAsync(_iter109, cancellationToken);
              await oprot.WriteStringAsync(Compaction_strategy_options[_iter109], cancellationToken);
            }
            await oprot.WriteMapEndAsync(cancellationToken);
          }
          await oprot.WriteFieldEndAsync(cancellationToken);
        }
        if((Compression_options != null) && __isset.compression_options)
        {
          field.Name = "compression_options";
          field.Type = TType.Map;
          field.ID = 32;
          await oprot.WriteFieldBeginAsync(field, cancellationToken);
          {
            await oprot.WriteMapBeginAsync(new TMap(TType.String, TType.String, Compression_options.Count), cancellationToken);
            foreach (string _iter110 in Compression_options.Keys)
            {
              await oprot.WriteStringAsync(_iter110, cancellationToken);
              await oprot.WriteStringAsync(Compression_options[_iter110], cancellationToken);
            }
            await oprot.WriteMapEndAsync(cancellationToken);
          }
          await oprot.WriteFieldEndAsync(cancellationToken);
        }
        if(__isset.bloom_filter_fp_chance)
        {
          field.Name = "bloom_filter_fp_chance";
          field.Type = TType.Double;
          field.ID = 33;
          await oprot.WriteFieldBeginAsync(field, cancellationToken);
          await oprot.WriteDoubleAsync(Bloom_filter_fp_chance, 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 CfDef other)) return false;
      if (ReferenceEquals(this, other)) return true;
      return System.Object.Equals(Keyspace, other.Keyspace)
        && System.Object.Equals(Name, other.Name)
        && ((__isset.column_type == other.__isset.column_type) && ((!__isset.column_type) || (System.Object.Equals(Column_type, other.Column_type))))
        && ((__isset.comparator_type == other.__isset.comparator_type) && ((!__isset.comparator_type) || (System.Object.Equals(Comparator_type, other.Comparator_type))))
        && ((__isset.subcomparator_type == other.__isset.subcomparator_type) && ((!__isset.subcomparator_type) || (System.Object.Equals(Subcomparator_type, other.Subcomparator_type))))
        && ((__isset.comment == other.__isset.comment) && ((!__isset.comment) || (System.Object.Equals(Comment, other.Comment))))
        && ((__isset.read_repair_chance == other.__isset.read_repair_chance) && ((!__isset.read_repair_chance) || (System.Object.Equals(Read_repair_chance, other.Read_repair_chance))))
        && ((__isset.column_metadata == other.__isset.column_metadata) && ((!__isset.column_metadata) || (TCollections.Equals(Column_metadata, other.Column_metadata))))
        && ((__isset.gc_grace_seconds == other.__isset.gc_grace_seconds) && ((!__isset.gc_grace_seconds) || (System.Object.Equals(Gc_grace_seconds, other.Gc_grace_seconds))))
        && ((__isset.default_validation_class == other.__isset.default_validation_class) && ((!__isset.default_validation_class) || (System.Object.Equals(Default_validation_class, other.Default_validation_class))))
        && ((__isset.id == other.__isset.id) && ((!__isset.id) || (System.Object.Equals(Id, other.Id))))
        && ((__isset.min_compaction_threshold == other.__isset.min_compaction_threshold) && ((!__isset.min_compaction_threshold) || (System.Object.Equals(Min_compaction_threshold, other.Min_compaction_threshold))))
        && ((__isset.max_compaction_threshold == other.__isset.max_compaction_threshold) && ((!__isset.max_compaction_threshold) || (System.Object.Equals(Max_compaction_threshold, other.Max_compaction_threshold))))
        && ((__isset.replicate_on_write == other.__isset.replicate_on_write) && ((!__isset.replicate_on_write) || (System.Object.Equals(Replicate_on_write, other.Replicate_on_write))))
        && ((__isset.merge_shards_chance == other.__isset.merge_shards_chance) && ((!__isset.merge_shards_chance) || (System.Object.Equals(Merge_shards_chance, other.Merge_shards_chance))))
        && ((__isset.key_validation_class == other.__isset.key_validation_class) && ((!__isset.key_validation_class) || (System.Object.Equals(Key_validation_class, other.Key_validation_class))))
        && ((__isset.key_alias == other.__isset.key_alias) && ((!__isset.key_alias) || (TCollections.Equals(Key_alias, other.Key_alias))))
        && ((__isset.compaction_strategy == other.__isset.compaction_strategy) && ((!__isset.compaction_strategy) || (System.Object.Equals(Compaction_strategy, other.Compaction_strategy))))
        && ((__isset.compaction_strategy_options == other.__isset.compaction_strategy_options) && ((!__isset.compaction_strategy_options) || (TCollections.Equals(Compaction_strategy_options, other.Compaction_strategy_options))))
        && ((__isset.compression_options == other.__isset.compression_options) && ((!__isset.compression_options) || (TCollections.Equals(Compression_options, other.Compression_options))))
        && ((__isset.bloom_filter_fp_chance == other.__isset.bloom_filter_fp_chance) && ((!__isset.bloom_filter_fp_chance) || (System.Object.Equals(Bloom_filter_fp_chance, other.Bloom_filter_fp_chance))));
    }

    public override int GetHashCode() {
      int hashcode = 157;
      unchecked {
        if((Keyspace != null))
        {
          hashcode = (hashcode * 397) + Keyspace.GetHashCode();
        }
        if((Name != null))
        {
          hashcode = (hashcode * 397) + Name.GetHashCode();
        }
        if((Column_type != null) && __isset.column_type)
        {
          hashcode = (hashcode * 397) + Column_type.GetHashCode();
        }
        if((Comparator_type != null) && __isset.comparator_type)
        {
          hashcode = (hashcode * 397) + Comparator_type.GetHashCode();
        }
        if((Subcomparator_type != null) && __isset.subcomparator_type)
        {
          hashcode = (hashcode * 397) + Subcomparator_type.GetHashCode();
        }
        if((Comment != null) && __isset.comment)
        {
          hashcode = (hashcode * 397) + Comment.GetHashCode();
        }
        if(__isset.read_repair_chance)
        {
          hashcode = (hashcode * 397) + Read_repair_chance.GetHashCode();
        }
        if((Column_metadata != null) && __isset.column_metadata)
        {
          hashcode = (hashcode * 397) + TCollections.GetHashCode(Column_metadata);
        }
        if(__isset.gc_grace_seconds)
        {
          hashcode = (hashcode * 397) + Gc_grace_seconds.GetHashCode();
        }
        if((Default_validation_class != null) && __isset.default_validation_class)
        {
          hashcode = (hashcode * 397) + Default_validation_class.GetHashCode();
        }
        if(__isset.id)
        {
          hashcode = (hashcode * 397) + Id.GetHashCode();
        }
        if(__isset.min_compaction_threshold)
        {
          hashcode = (hashcode * 397) + Min_compaction_threshold.GetHashCode();
        }
        if(__isset.max_compaction_threshold)
        {
          hashcode = (hashcode * 397) + Max_compaction_threshold.GetHashCode();
        }
        if(__isset.replicate_on_write)
        {
          hashcode = (hashcode * 397) + Replicate_on_write.GetHashCode();
        }
        if(__isset.merge_shards_chance)
        {
          hashcode = (hashcode * 397) + Merge_shards_chance.GetHashCode();
        }
        if((Key_validation_class != null) && __isset.key_validation_class)
        {
          hashcode = (hashcode * 397) + Key_validation_class.GetHashCode();
        }
        if((Key_alias != null) && __isset.key_alias)
        {
          hashcode = (hashcode * 397) + Key_alias.GetHashCode();
        }
        if((Compaction_strategy != null) && __isset.compaction_strategy)
        {
          hashcode = (hashcode * 397) + Compaction_strategy.GetHashCode();
        }
        if((Compaction_strategy_options != null) && __isset.compaction_strategy_options)
        {
          hashcode = (hashcode * 397) + TCollections.GetHashCode(Compaction_strategy_options);
        }
        if((Compression_options != null) && __isset.compression_options)
        {
          hashcode = (hashcode * 397) + TCollections.GetHashCode(Compression_options);
        }
        if(__isset.bloom_filter_fp_chance)
        {
          hashcode = (hashcode * 397) + Bloom_filter_fp_chance.GetHashCode();
        }
      }
      return hashcode;
    }

    public override string ToString()
    {
      var sb = new StringBuilder("CfDef(");
      if((Keyspace != null))
      {
        sb.Append(", Keyspace: ");
        Keyspace.ToString(sb);
      }
      if((Name != null))
      {
        sb.Append(", Name: ");
        Name.ToString(sb);
      }
      if((Column_type != null) && __isset.column_type)
      {
        sb.Append(", Column_type: ");
        Column_type.ToString(sb);
      }
      if((Comparator_type != null) && __isset.comparator_type)
      {
        sb.Append(", Comparator_type: ");
        Comparator_type.ToString(sb);
      }
      if((Subcomparator_type != null) && __isset.subcomparator_type)
      {
        sb.Append(", Subcomparator_type: ");
        Subcomparator_type.ToString(sb);
      }
      if((Comment != null) && __isset.comment)
      {
        sb.Append(", Comment: ");
        Comment.ToString(sb);
      }
      if(__isset.read_repair_chance)
      {
        sb.Append(", Read_repair_chance: ");
        Read_repair_chance.ToString(sb);
      }
      if((Column_metadata != null) && __isset.column_metadata)
      {
        sb.Append(", Column_metadata: ");
        Column_metadata.ToString(sb);
      }
      if(__isset.gc_grace_seconds)
      {
        sb.Append(", Gc_grace_seconds: ");
        Gc_grace_seconds.ToString(sb);
      }
      if((Default_validation_class != null) && __isset.default_validation_class)
      {
        sb.Append(", Default_validation_class: ");
        Default_validation_class.ToString(sb);
      }
      if(__isset.id)
      {
        sb.Append(", Id: ");
        Id.ToString(sb);
      }
      if(__isset.min_compaction_threshold)
      {
        sb.Append(", Min_compaction_threshold: ");
        Min_compaction_threshold.ToString(sb);
      }
      if(__isset.max_compaction_threshold)
      {
        sb.Append(", Max_compaction_threshold: ");
        Max_compaction_threshold.ToString(sb);
      }
      if(__isset.replicate_on_write)
      {
        sb.Append(", Replicate_on_write: ");
        Replicate_on_write.ToString(sb);
      }
      if(__isset.merge_shards_chance)
      {
        sb.Append(", Merge_shards_chance: ");
        Merge_shards_chance.ToString(sb);
      }
      if((Key_validation_class != null) && __isset.key_validation_class)
      {
        sb.Append(", Key_validation_class: ");
        Key_validation_class.ToString(sb);
      }
      if((Key_alias != null) && __isset.key_alias)
      {
        sb.Append(", Key_alias: ");
        Key_alias.ToString(sb);
      }
      if((Compaction_strategy != null) && __isset.compaction_strategy)
      {
        sb.Append(", Compaction_strategy: ");
        Compaction_strategy.ToString(sb);
      }
      if((Compaction_strategy_options != null) && __isset.compaction_strategy_options)
      {
        sb.Append(", Compaction_strategy_options: ");
        Compaction_strategy_options.ToString(sb);
      }
      if((Compression_options != null) && __isset.compression_options)
      {
        sb.Append(", Compression_options: ");
        Compression_options.ToString(sb);
      }
      if(__isset.bloom_filter_fp_chance)
      {
        sb.Append(", Bloom_filter_fp_chance: ");
        Bloom_filter_fp_chance.ToString(sb);
      }
      sb.Append(')');
      return sb.ToString();
    }
  }

}
