/**
 * Autogenerated by Thrift Compiler (1.0.0-dev)
 *
 * 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 Thrift;
using Thrift.Collections;
using System.Runtime.Serialization;
using Thrift.Protocol;
using Thrift.Transport;

namespace Evernote.EDAM.Type
{

  /// <summary>
  /// Represents the owner's account related limits on a Note.
  /// The field uploaded represents the total number of bytes that have been uploaded
  /// to this account and is taken from the SyncState struct. All other fields
  /// represent account related limits and are taken from the AccountLimits struct.
  /// <p />
  /// See SyncState and AccountLimits struct field definitions for more details.
  /// </summary>
  #if !SILVERLIGHT
  [Serializable]
  #endif
  public partial class NoteLimits : TBase
  {
    private int _noteResourceCountMax;
    private long _uploadLimit;
    private long _resourceSizeMax;
    private long _noteSizeMax;
    private long _uploaded;

    public int NoteResourceCountMax
    {
      get
      {
        return _noteResourceCountMax;
      }
      set
      {
        __isset.noteResourceCountMax = true;
        this._noteResourceCountMax = value;
      }
    }

    public long UploadLimit
    {
      get
      {
        return _uploadLimit;
      }
      set
      {
        __isset.uploadLimit = true;
        this._uploadLimit = value;
      }
    }

    public long ResourceSizeMax
    {
      get
      {
        return _resourceSizeMax;
      }
      set
      {
        __isset.resourceSizeMax = true;
        this._resourceSizeMax = value;
      }
    }

    public long NoteSizeMax
    {
      get
      {
        return _noteSizeMax;
      }
      set
      {
        __isset.noteSizeMax = true;
        this._noteSizeMax = value;
      }
    }

    public long Uploaded
    {
      get
      {
        return _uploaded;
      }
      set
      {
        __isset.uploaded = true;
        this._uploaded = value;
      }
    }


    public Isset __isset;
    #if !SILVERLIGHT
    [Serializable]
    #endif
    public struct Isset {
      public bool noteResourceCountMax;
      public bool uploadLimit;
      public bool resourceSizeMax;
      public bool noteSizeMax;
      public bool uploaded;
    }

    public NoteLimits() {
    }

    public void Read (TProtocol iprot)
    {
      iprot.IncrementRecursionDepth();
      try
      {
        TField field;
        iprot.ReadStructBegin();
        while (true)
        {
          field = iprot.ReadFieldBegin();
          if (field.Type == TType.Stop) { 
            break;
          }
          switch (field.ID)
          {
            case 1:
              if (field.Type == TType.I32) {
                NoteResourceCountMax = iprot.ReadI32();
              } else { 
                TProtocolUtil.Skip(iprot, field.Type);
              }
              break;
            case 2:
              if (field.Type == TType.I64) {
                UploadLimit = iprot.ReadI64();
              } else { 
                TProtocolUtil.Skip(iprot, field.Type);
              }
              break;
            case 3:
              if (field.Type == TType.I64) {
                ResourceSizeMax = iprot.ReadI64();
              } else { 
                TProtocolUtil.Skip(iprot, field.Type);
              }
              break;
            case 4:
              if (field.Type == TType.I64) {
                NoteSizeMax = iprot.ReadI64();
              } else { 
                TProtocolUtil.Skip(iprot, field.Type);
              }
              break;
            case 5:
              if (field.Type == TType.I64) {
                Uploaded = iprot.ReadI64();
              } else { 
                TProtocolUtil.Skip(iprot, field.Type);
              }
              break;
            default: 
              TProtocolUtil.Skip(iprot, field.Type);
              break;
          }
          iprot.ReadFieldEnd();
        }
        iprot.ReadStructEnd();
      }
      finally
      {
        iprot.DecrementRecursionDepth();
      }
    }

    public void Write(TProtocol oprot) {
      oprot.IncrementRecursionDepth();
      try
      {
        TStruct struc = new TStruct("NoteLimits");
        oprot.WriteStructBegin(struc);
        TField field = new TField();
        if (__isset.noteResourceCountMax) {
          field.Name = "noteResourceCountMax";
          field.Type = TType.I32;
          field.ID = 1;
          oprot.WriteFieldBegin(field);
          oprot.WriteI32(NoteResourceCountMax);
          oprot.WriteFieldEnd();
        }
        if (__isset.uploadLimit) {
          field.Name = "uploadLimit";
          field.Type = TType.I64;
          field.ID = 2;
          oprot.WriteFieldBegin(field);
          oprot.WriteI64(UploadLimit);
          oprot.WriteFieldEnd();
        }
        if (__isset.resourceSizeMax) {
          field.Name = "resourceSizeMax";
          field.Type = TType.I64;
          field.ID = 3;
          oprot.WriteFieldBegin(field);
          oprot.WriteI64(ResourceSizeMax);
          oprot.WriteFieldEnd();
        }
        if (__isset.noteSizeMax) {
          field.Name = "noteSizeMax";
          field.Type = TType.I64;
          field.ID = 4;
          oprot.WriteFieldBegin(field);
          oprot.WriteI64(NoteSizeMax);
          oprot.WriteFieldEnd();
        }
        if (__isset.uploaded) {
          field.Name = "uploaded";
          field.Type = TType.I64;
          field.ID = 5;
          oprot.WriteFieldBegin(field);
          oprot.WriteI64(Uploaded);
          oprot.WriteFieldEnd();
        }
        oprot.WriteFieldStop();
        oprot.WriteStructEnd();
      }
      finally
      {
        oprot.DecrementRecursionDepth();
      }
    }

    public override string ToString() {
      StringBuilder __sb = new StringBuilder("NoteLimits(");
      bool __first = true;
      if (__isset.noteResourceCountMax) {
        if(!__first) { __sb.Append(", "); }
        __first = false;
        __sb.Append("NoteResourceCountMax: ");
        __sb.Append(NoteResourceCountMax);
      }
      if (__isset.uploadLimit) {
        if(!__first) { __sb.Append(", "); }
        __first = false;
        __sb.Append("UploadLimit: ");
        __sb.Append(UploadLimit);
      }
      if (__isset.resourceSizeMax) {
        if(!__first) { __sb.Append(", "); }
        __first = false;
        __sb.Append("ResourceSizeMax: ");
        __sb.Append(ResourceSizeMax);
      }
      if (__isset.noteSizeMax) {
        if(!__first) { __sb.Append(", "); }
        __first = false;
        __sb.Append("NoteSizeMax: ");
        __sb.Append(NoteSizeMax);
      }
      if (__isset.uploaded) {
        if(!__first) { __sb.Append(", "); }
        __first = false;
        __sb.Append("Uploaded: ");
        __sb.Append(Uploaded);
      }
      __sb.Append(")");
      return __sb.ToString();
    }

  }

}
