/**
 * Autogenerated by Thrift
 *
 * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
 */
using System;
using System.Collections;
using System.Collections.Generic;
using System.Text;
using System.IO;
using Thrift;
using Thrift.Collections;
using Thrift.Protocol;
using Thrift.Transport;
namespace Evernote.EDAM.Type
{

  #if !SILVERLIGHT && !NETFX_CORE
  [Serializable]
  #endif
  public partial class LazyMap : TBase
  {
    private THashSet<string> _keysOnly;
    private Dictionary<string, string> _fullMap;

    public THashSet<string> KeysOnly
    {
      get
      {
        return _keysOnly;
      }
      set
      {
        __isset.keysOnly = true;
        this._keysOnly = value;
      }
    }

    public Dictionary<string, string> FullMap
    {
      get
      {
        return _fullMap;
      }
      set
      {
        __isset.fullMap = true;
        this._fullMap = value;
      }
    }


    public Isset __isset;
    #if !SILVERLIGHT && !NETFX_CORE
    [Serializable]
    #endif
    public struct Isset {
      public bool keysOnly;
      public bool fullMap;
    }

    public LazyMap() {
    }

    public void Read (TProtocol iprot)
    {
      TField field;
      iprot.ReadStructBegin();
      while (true)
      {
        field = iprot.ReadFieldBegin();
        if (field.Type == TType.Stop) { 
          break;
        }
        switch (field.ID)
        {
          case 1:
            if (field.Type == TType.Set) {
              {
                KeysOnly = new THashSet<string>();
                TSet _set8 = iprot.ReadSetBegin();
                for( int _i9 = 0; _i9 < _set8.Count; ++_i9)
                {
                  string _elem10 = null;
                  _elem10 = iprot.ReadString();
                  KeysOnly.Add(_elem10);
                }
                iprot.ReadSetEnd();
              }
            } else { 
              TProtocolUtil.Skip(iprot, field.Type);
            }
            break;
          case 2:
            if (field.Type == TType.Map) {
              {
                FullMap = new Dictionary<string, string>();
                TMap _map11 = iprot.ReadMapBegin();
                for( int _i12 = 0; _i12 < _map11.Count; ++_i12)
                {
                  string _key13;
                  string _val14;
                  _key13 = iprot.ReadString();
                  _val14 = iprot.ReadString();
                  FullMap[_key13] = _val14;
                }
                iprot.ReadMapEnd();
              }
            } else { 
              TProtocolUtil.Skip(iprot, field.Type);
            }
            break;
          default: 
            TProtocolUtil.Skip(iprot, field.Type);
            break;
        }
        iprot.ReadFieldEnd();
      }
      iprot.ReadStructEnd();
    }

    public void Write(TProtocol oprot) {
      TStruct struc = new TStruct("LazyMap");
      oprot.WriteStructBegin(struc);
      TField field = new TField();
      if (KeysOnly != null && __isset.keysOnly) {
        field.Name = "keysOnly";
        field.Type = TType.Set;
        field.ID = 1;
        oprot.WriteFieldBegin(field);
        {
          oprot.WriteSetBegin(new TSet(TType.String, KeysOnly.Count));
          foreach (string _iter15 in KeysOnly)
          {
            oprot.WriteString(_iter15);
            oprot.WriteSetEnd();
          }
        }
        oprot.WriteFieldEnd();
      }
      if (FullMap != null && __isset.fullMap) {
        field.Name = "fullMap";
        field.Type = TType.Map;
        field.ID = 2;
        oprot.WriteFieldBegin(field);
        {
          oprot.WriteMapBegin(new TMap(TType.String, TType.String, FullMap.Count));
          foreach (string _iter16 in FullMap.Keys)
          {
            oprot.WriteString(_iter16);
            oprot.WriteString(FullMap[_iter16]);
            oprot.WriteMapEnd();
          }
        }
        oprot.WriteFieldEnd();
      }
      oprot.WriteFieldStop();
      oprot.WriteStructEnd();
    }

    public override string ToString() {
      StringBuilder sb = new StringBuilder("LazyMap(");
      sb.Append("KeysOnly: ");
      sb.Append(KeysOnly);
      sb.Append(",FullMap: ");
      sb.Append(FullMap);
      sb.Append(")");
      return sb.ToString();
    }

  }

}
