/**
 * 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 Notebook : TBase
  {
    private string _guid;
    private string _name;
    private int _updateSequenceNum;
    private bool _defaultNotebook;
    private long _serviceCreated;
    private long _serviceUpdated;
    private Publishing _publishing;
    private bool _published;
    private string _stack;
    private List<long> _sharedNotebookIds;
    private List<SharedNotebook> _sharedNotebooks;
    private BusinessNotebook _businessNotebook;
    private User _contact;
    private NotebookRestrictions _restrictions;

    public string Guid
    {
      get
      {
        return _guid;
      }
      set
      {
        __isset.guid = true;
        this._guid = value;
      }
    }

    public string Name
    {
      get
      {
        return _name;
      }
      set
      {
        __isset.name = true;
        this._name = value;
      }
    }

    public int UpdateSequenceNum
    {
      get
      {
        return _updateSequenceNum;
      }
      set
      {
        __isset.updateSequenceNum = true;
        this._updateSequenceNum = value;
      }
    }

    public bool DefaultNotebook
    {
      get
      {
        return _defaultNotebook;
      }
      set
      {
        __isset.defaultNotebook = true;
        this._defaultNotebook = value;
      }
    }

    public long ServiceCreated
    {
      get
      {
        return _serviceCreated;
      }
      set
      {
        __isset.serviceCreated = true;
        this._serviceCreated = value;
      }
    }

    public long ServiceUpdated
    {
      get
      {
        return _serviceUpdated;
      }
      set
      {
        __isset.serviceUpdated = true;
        this._serviceUpdated = value;
      }
    }

    public Publishing Publishing
    {
      get
      {
        return _publishing;
      }
      set
      {
        __isset.publishing = true;
        this._publishing = value;
      }
    }

    public bool Published
    {
      get
      {
        return _published;
      }
      set
      {
        __isset.published = true;
        this._published = value;
      }
    }

    public string Stack
    {
      get
      {
        return _stack;
      }
      set
      {
        __isset.stack = true;
        this._stack = value;
      }
    }

    public List<long> SharedNotebookIds
    {
      get
      {
        return _sharedNotebookIds;
      }
      set
      {
        __isset.sharedNotebookIds = true;
        this._sharedNotebookIds = value;
      }
    }

    public List<SharedNotebook> SharedNotebooks
    {
      get
      {
        return _sharedNotebooks;
      }
      set
      {
        __isset.sharedNotebooks = true;
        this._sharedNotebooks = value;
      }
    }

    public BusinessNotebook BusinessNotebook
    {
      get
      {
        return _businessNotebook;
      }
      set
      {
        __isset.businessNotebook = true;
        this._businessNotebook = value;
      }
    }

    public User Contact
    {
      get
      {
        return _contact;
      }
      set
      {
        __isset.contact = true;
        this._contact = value;
      }
    }

    public NotebookRestrictions Restrictions
    {
      get
      {
        return _restrictions;
      }
      set
      {
        __isset.restrictions = true;
        this._restrictions = value;
      }
    }


    public Isset __isset;
    #if !SILVERLIGHT && !NETFX_CORE
    [Serializable]
    #endif
    public struct Isset {
      public bool guid;
      public bool name;
      public bool updateSequenceNum;
      public bool defaultNotebook;
      public bool serviceCreated;
      public bool serviceUpdated;
      public bool publishing;
      public bool published;
      public bool stack;
      public bool sharedNotebookIds;
      public bool sharedNotebooks;
      public bool businessNotebook;
      public bool contact;
      public bool restrictions;
    }

    public Notebook() {
    }

    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.String) {
              Guid = iprot.ReadString();
            } else { 
              TProtocolUtil.Skip(iprot, field.Type);
            }
            break;
          case 2:
            if (field.Type == TType.String) {
              Name = iprot.ReadString();
            } else { 
              TProtocolUtil.Skip(iprot, field.Type);
            }
            break;
          case 5:
            if (field.Type == TType.I32) {
              UpdateSequenceNum = iprot.ReadI32();
            } else { 
              TProtocolUtil.Skip(iprot, field.Type);
            }
            break;
          case 6:
            if (field.Type == TType.Bool) {
              DefaultNotebook = iprot.ReadBool();
            } else { 
              TProtocolUtil.Skip(iprot, field.Type);
            }
            break;
          case 7:
            if (field.Type == TType.I64) {
              ServiceCreated = iprot.ReadI64();
            } else { 
              TProtocolUtil.Skip(iprot, field.Type);
            }
            break;
          case 8:
            if (field.Type == TType.I64) {
              ServiceUpdated = iprot.ReadI64();
            } else { 
              TProtocolUtil.Skip(iprot, field.Type);
            }
            break;
          case 10:
            if (field.Type == TType.Struct) {
              Publishing = new Publishing();
              Publishing.Read(iprot);
            } else { 
              TProtocolUtil.Skip(iprot, field.Type);
            }
            break;
          case 11:
            if (field.Type == TType.Bool) {
              Published = iprot.ReadBool();
            } else { 
              TProtocolUtil.Skip(iprot, field.Type);
            }
            break;
          case 12:
            if (field.Type == TType.String) {
              Stack = iprot.ReadString();
            } else { 
              TProtocolUtil.Skip(iprot, field.Type);
            }
            break;
          case 13:
            if (field.Type == TType.List) {
              {
                SharedNotebookIds = new List<long>();
                TList _list34 = iprot.ReadListBegin();
                for( int _i35 = 0; _i35 < _list34.Count; ++_i35)
                {
                  long _elem36 = 0;
                  _elem36 = iprot.ReadI64();
                  SharedNotebookIds.Add(_elem36);
                }
                iprot.ReadListEnd();
              }
            } else { 
              TProtocolUtil.Skip(iprot, field.Type);
            }
            break;
          case 14:
            if (field.Type == TType.List) {
              {
                SharedNotebooks = new List<SharedNotebook>();
                TList _list37 = iprot.ReadListBegin();
                for( int _i38 = 0; _i38 < _list37.Count; ++_i38)
                {
                  SharedNotebook _elem39 = new SharedNotebook();
                  _elem39 = new SharedNotebook();
                  _elem39.Read(iprot);
                  SharedNotebooks.Add(_elem39);
                }
                iprot.ReadListEnd();
              }
            } else { 
              TProtocolUtil.Skip(iprot, field.Type);
            }
            break;
          case 15:
            if (field.Type == TType.Struct) {
              BusinessNotebook = new BusinessNotebook();
              BusinessNotebook.Read(iprot);
            } else { 
              TProtocolUtil.Skip(iprot, field.Type);
            }
            break;
          case 16:
            if (field.Type == TType.Struct) {
              Contact = new User();
              Contact.Read(iprot);
            } else { 
              TProtocolUtil.Skip(iprot, field.Type);
            }
            break;
          case 17:
            if (field.Type == TType.Struct) {
              Restrictions = new NotebookRestrictions();
              Restrictions.Read(iprot);
            } 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("Notebook");
      oprot.WriteStructBegin(struc);
      TField field = new TField();
      if (Guid != null && __isset.guid) {
        field.Name = "guid";
        field.Type = TType.String;
        field.ID = 1;
        oprot.WriteFieldBegin(field);
        oprot.WriteString(Guid);
        oprot.WriteFieldEnd();
      }
      if (Name != null && __isset.name) {
        field.Name = "name";
        field.Type = TType.String;
        field.ID = 2;
        oprot.WriteFieldBegin(field);
        oprot.WriteString(Name);
        oprot.WriteFieldEnd();
      }
      if (__isset.updateSequenceNum) {
        field.Name = "updateSequenceNum";
        field.Type = TType.I32;
        field.ID = 5;
        oprot.WriteFieldBegin(field);
        oprot.WriteI32(UpdateSequenceNum);
        oprot.WriteFieldEnd();
      }
      if (__isset.defaultNotebook) {
        field.Name = "defaultNotebook";
        field.Type = TType.Bool;
        field.ID = 6;
        oprot.WriteFieldBegin(field);
        oprot.WriteBool(DefaultNotebook);
        oprot.WriteFieldEnd();
      }
      if (__isset.serviceCreated) {
        field.Name = "serviceCreated";
        field.Type = TType.I64;
        field.ID = 7;
        oprot.WriteFieldBegin(field);
        oprot.WriteI64(ServiceCreated);
        oprot.WriteFieldEnd();
      }
      if (__isset.serviceUpdated) {
        field.Name = "serviceUpdated";
        field.Type = TType.I64;
        field.ID = 8;
        oprot.WriteFieldBegin(field);
        oprot.WriteI64(ServiceUpdated);
        oprot.WriteFieldEnd();
      }
      if (Publishing != null && __isset.publishing) {
        field.Name = "publishing";
        field.Type = TType.Struct;
        field.ID = 10;
        oprot.WriteFieldBegin(field);
        Publishing.Write(oprot);
        oprot.WriteFieldEnd();
      }
      if (__isset.published) {
        field.Name = "published";
        field.Type = TType.Bool;
        field.ID = 11;
        oprot.WriteFieldBegin(field);
        oprot.WriteBool(Published);
        oprot.WriteFieldEnd();
      }
      if (Stack != null && __isset.stack) {
        field.Name = "stack";
        field.Type = TType.String;
        field.ID = 12;
        oprot.WriteFieldBegin(field);
        oprot.WriteString(Stack);
        oprot.WriteFieldEnd();
      }
      if (SharedNotebookIds != null && __isset.sharedNotebookIds) {
        field.Name = "sharedNotebookIds";
        field.Type = TType.List;
        field.ID = 13;
        oprot.WriteFieldBegin(field);
        {
          oprot.WriteListBegin(new TList(TType.I64, SharedNotebookIds.Count));
          foreach (long _iter40 in SharedNotebookIds)
          {
            oprot.WriteI64(_iter40);
            oprot.WriteListEnd();
          }
        }
        oprot.WriteFieldEnd();
      }
      if (SharedNotebooks != null && __isset.sharedNotebooks) {
        field.Name = "sharedNotebooks";
        field.Type = TType.List;
        field.ID = 14;
        oprot.WriteFieldBegin(field);
        {
          oprot.WriteListBegin(new TList(TType.Struct, SharedNotebooks.Count));
          foreach (SharedNotebook _iter41 in SharedNotebooks)
          {
            _iter41.Write(oprot);
            oprot.WriteListEnd();
          }
        }
        oprot.WriteFieldEnd();
      }
      if (BusinessNotebook != null && __isset.businessNotebook) {
        field.Name = "businessNotebook";
        field.Type = TType.Struct;
        field.ID = 15;
        oprot.WriteFieldBegin(field);
        BusinessNotebook.Write(oprot);
        oprot.WriteFieldEnd();
      }
      if (Contact != null && __isset.contact) {
        field.Name = "contact";
        field.Type = TType.Struct;
        field.ID = 16;
        oprot.WriteFieldBegin(field);
        Contact.Write(oprot);
        oprot.WriteFieldEnd();
      }
      if (Restrictions != null && __isset.restrictions) {
        field.Name = "restrictions";
        field.Type = TType.Struct;
        field.ID = 17;
        oprot.WriteFieldBegin(field);
        Restrictions.Write(oprot);
        oprot.WriteFieldEnd();
      }
      oprot.WriteFieldStop();
      oprot.WriteStructEnd();
    }

    public override string ToString() {
      StringBuilder sb = new StringBuilder("Notebook(");
      sb.Append("Guid: ");
      sb.Append(Guid);
      sb.Append(",Name: ");
      sb.Append(Name);
      sb.Append(",UpdateSequenceNum: ");
      sb.Append(UpdateSequenceNum);
      sb.Append(",DefaultNotebook: ");
      sb.Append(DefaultNotebook);
      sb.Append(",ServiceCreated: ");
      sb.Append(ServiceCreated);
      sb.Append(",ServiceUpdated: ");
      sb.Append(ServiceUpdated);
      sb.Append(",Publishing: ");
      sb.Append(Publishing== null ? "<null>" : Publishing.ToString());
      sb.Append(",Published: ");
      sb.Append(Published);
      sb.Append(",Stack: ");
      sb.Append(Stack);
      sb.Append(",SharedNotebookIds: ");
      sb.Append(SharedNotebookIds);
      sb.Append(",SharedNotebooks: ");
      sb.Append(SharedNotebooks);
      sb.Append(",BusinessNotebook: ");
      sb.Append(BusinessNotebook== null ? "<null>" : BusinessNotebook.ToString());
      sb.Append(",Contact: ");
      sb.Append(Contact== null ? "<null>" : Contact.ToString());
      sb.Append(",Restrictions: ");
      sb.Append(Restrictions== null ? "<null>" : Restrictions.ToString());
      sb.Append(")");
      return sb.ToString();
    }

  }

}
