/**
 * 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.NoteStore
{

  #if !SILVERLIGHT && !NETFX_CORE
  [Serializable]
  #endif
  public partial class NoteCollectionCounts : TBase
  {
    private Dictionary<string, int> _notebookCounts;
    private Dictionary<string, int> _tagCounts;
    private int _trashCount;

    public Dictionary<string, int> NotebookCounts
    {
      get
      {
        return _notebookCounts;
      }
      set
      {
        __isset.notebookCounts = true;
        this._notebookCounts = value;
      }
    }

    public Dictionary<string, int> TagCounts
    {
      get
      {
        return _tagCounts;
      }
      set
      {
        __isset.tagCounts = true;
        this._tagCounts = value;
      }
    }

    public int TrashCount
    {
      get
      {
        return _trashCount;
      }
      set
      {
        __isset.trashCount = true;
        this._trashCount = value;
      }
    }


    public Isset __isset;
    #if !SILVERLIGHT && !NETFX_CORE
    [Serializable]
    #endif
    public struct Isset {
      public bool notebookCounts;
      public bool tagCounts;
      public bool trashCount;
    }

    public NoteCollectionCounts() {
    }

    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.Map) {
              {
                NotebookCounts = new Dictionary<string, int>();
                TMap _map76 = iprot.ReadMapBegin();
                for( int _i77 = 0; _i77 < _map76.Count; ++_i77)
                {
                  string _key78;
                  int _val79;
                  _key78 = iprot.ReadString();
                  _val79 = iprot.ReadI32();
                  NotebookCounts[_key78] = _val79;
                }
                iprot.ReadMapEnd();
              }
            } else { 
              TProtocolUtil.Skip(iprot, field.Type);
            }
            break;
          case 2:
            if (field.Type == TType.Map) {
              {
                TagCounts = new Dictionary<string, int>();
                TMap _map80 = iprot.ReadMapBegin();
                for( int _i81 = 0; _i81 < _map80.Count; ++_i81)
                {
                  string _key82;
                  int _val83;
                  _key82 = iprot.ReadString();
                  _val83 = iprot.ReadI32();
                  TagCounts[_key82] = _val83;
                }
                iprot.ReadMapEnd();
              }
            } else { 
              TProtocolUtil.Skip(iprot, field.Type);
            }
            break;
          case 3:
            if (field.Type == TType.I32) {
              TrashCount = iprot.ReadI32();
            } 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("NoteCollectionCounts");
      oprot.WriteStructBegin(struc);
      TField field = new TField();
      if (NotebookCounts != null && __isset.notebookCounts) {
        field.Name = "notebookCounts";
        field.Type = TType.Map;
        field.ID = 1;
        oprot.WriteFieldBegin(field);
        {
          oprot.WriteMapBegin(new TMap(TType.String, TType.I32, NotebookCounts.Count));
          foreach (string _iter84 in NotebookCounts.Keys)
          {
            oprot.WriteString(_iter84);
            oprot.WriteI32(NotebookCounts[_iter84]);
            oprot.WriteMapEnd();
          }
        }
        oprot.WriteFieldEnd();
      }
      if (TagCounts != null && __isset.tagCounts) {
        field.Name = "tagCounts";
        field.Type = TType.Map;
        field.ID = 2;
        oprot.WriteFieldBegin(field);
        {
          oprot.WriteMapBegin(new TMap(TType.String, TType.I32, TagCounts.Count));
          foreach (string _iter85 in TagCounts.Keys)
          {
            oprot.WriteString(_iter85);
            oprot.WriteI32(TagCounts[_iter85]);
            oprot.WriteMapEnd();
          }
        }
        oprot.WriteFieldEnd();
      }
      if (__isset.trashCount) {
        field.Name = "trashCount";
        field.Type = TType.I32;
        field.ID = 3;
        oprot.WriteFieldBegin(field);
        oprot.WriteI32(TrashCount);
        oprot.WriteFieldEnd();
      }
      oprot.WriteFieldStop();
      oprot.WriteStructEnd();
    }

    public override string ToString() {
      StringBuilder sb = new StringBuilder("NoteCollectionCounts(");
      sb.Append("NotebookCounts: ");
      sb.Append(NotebookCounts);
      sb.Append(",TagCounts: ");
      sb.Append(TagCounts);
      sb.Append(",TrashCount: ");
      sb.Append(TrashCount);
      sb.Append(")");
      return sb.ToString();
    }

  }

}
