/**
 * 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 SharedNotebook : TBase
  {
    private long _id;
    private int _userId;
    private string _notebookGuid;
    private string _email;
    private bool _notebookModifiable;
    private bool _requireLogin;
    private long _serviceCreated;
    private long _serviceUpdated;
    private string _shareKey;
    private string _username;
    private SharedNotebookPrivilegeLevel _privilege;
    private bool _allowPreview;
    private SharedNotebookRecipientSettings _recipientSettings;

    public long Id
    {
      get
      {
        return _id;
      }
      set
      {
        __isset.id = true;
        this._id = value;
      }
    }

    public int UserId
    {
      get
      {
        return _userId;
      }
      set
      {
        __isset.userId = true;
        this._userId = value;
      }
    }

    public string NotebookGuid
    {
      get
      {
        return _notebookGuid;
      }
      set
      {
        __isset.notebookGuid = true;
        this._notebookGuid = value;
      }
    }

    public string Email
    {
      get
      {
        return _email;
      }
      set
      {
        __isset.email = true;
        this._email = value;
      }
    }

    public bool NotebookModifiable
    {
      get
      {
        return _notebookModifiable;
      }
      set
      {
        __isset.notebookModifiable = true;
        this._notebookModifiable = value;
      }
    }

    public bool RequireLogin
    {
      get
      {
        return _requireLogin;
      }
      set
      {
        __isset.requireLogin = true;
        this._requireLogin = 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 string ShareKey
    {
      get
      {
        return _shareKey;
      }
      set
      {
        __isset.shareKey = true;
        this._shareKey = value;
      }
    }

    public string Username
    {
      get
      {
        return _username;
      }
      set
      {
        __isset.username = true;
        this._username = value;
      }
    }

    public SharedNotebookPrivilegeLevel Privilege
    {
      get
      {
        return _privilege;
      }
      set
      {
        __isset.privilege = true;
        this._privilege = value;
      }
    }

    public bool AllowPreview
    {
      get
      {
        return _allowPreview;
      }
      set
      {
        __isset.allowPreview = true;
        this._allowPreview = value;
      }
    }

    public SharedNotebookRecipientSettings RecipientSettings
    {
      get
      {
        return _recipientSettings;
      }
      set
      {
        __isset.recipientSettings = true;
        this._recipientSettings = value;
      }
    }


    public Isset __isset;
    #if !SILVERLIGHT && !NETFX_CORE
    [Serializable]
    #endif
    public struct Isset {
      public bool id;
      public bool userId;
      public bool notebookGuid;
      public bool email;
      public bool notebookModifiable;
      public bool requireLogin;
      public bool serviceCreated;
      public bool serviceUpdated;
      public bool shareKey;
      public bool username;
      public bool privilege;
      public bool allowPreview;
      public bool recipientSettings;
    }

    public SharedNotebook() {
    }

    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.I64) {
              Id = iprot.ReadI64();
            } else { 
              TProtocolUtil.Skip(iprot, field.Type);
            }
            break;
          case 2:
            if (field.Type == TType.I32) {
              UserId = iprot.ReadI32();
            } else { 
              TProtocolUtil.Skip(iprot, field.Type);
            }
            break;
          case 3:
            if (field.Type == TType.String) {
              NotebookGuid = iprot.ReadString();
            } else { 
              TProtocolUtil.Skip(iprot, field.Type);
            }
            break;
          case 4:
            if (field.Type == TType.String) {
              Email = iprot.ReadString();
            } else { 
              TProtocolUtil.Skip(iprot, field.Type);
            }
            break;
          case 5:
            if (field.Type == TType.Bool) {
              NotebookModifiable = iprot.ReadBool();
            } else { 
              TProtocolUtil.Skip(iprot, field.Type);
            }
            break;
          case 6:
            if (field.Type == TType.Bool) {
              RequireLogin = 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 10:
            if (field.Type == TType.I64) {
              ServiceUpdated = iprot.ReadI64();
            } else { 
              TProtocolUtil.Skip(iprot, field.Type);
            }
            break;
          case 8:
            if (field.Type == TType.String) {
              ShareKey = iprot.ReadString();
            } else { 
              TProtocolUtil.Skip(iprot, field.Type);
            }
            break;
          case 9:
            if (field.Type == TType.String) {
              Username = iprot.ReadString();
            } else { 
              TProtocolUtil.Skip(iprot, field.Type);
            }
            break;
          case 11:
            if (field.Type == TType.I32) {
              Privilege = (SharedNotebookPrivilegeLevel)iprot.ReadI32();
            } else { 
              TProtocolUtil.Skip(iprot, field.Type);
            }
            break;
          case 12:
            if (field.Type == TType.Bool) {
              AllowPreview = iprot.ReadBool();
            } else { 
              TProtocolUtil.Skip(iprot, field.Type);
            }
            break;
          case 13:
            if (field.Type == TType.Struct) {
              RecipientSettings = new SharedNotebookRecipientSettings();
              RecipientSettings.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("SharedNotebook");
      oprot.WriteStructBegin(struc);
      TField field = new TField();
      if (__isset.id) {
        field.Name = "id";
        field.Type = TType.I64;
        field.ID = 1;
        oprot.WriteFieldBegin(field);
        oprot.WriteI64(Id);
        oprot.WriteFieldEnd();
      }
      if (__isset.userId) {
        field.Name = "userId";
        field.Type = TType.I32;
        field.ID = 2;
        oprot.WriteFieldBegin(field);
        oprot.WriteI32(UserId);
        oprot.WriteFieldEnd();
      }
      if (NotebookGuid != null && __isset.notebookGuid) {
        field.Name = "notebookGuid";
        field.Type = TType.String;
        field.ID = 3;
        oprot.WriteFieldBegin(field);
        oprot.WriteString(NotebookGuid);
        oprot.WriteFieldEnd();
      }
      if (Email != null && __isset.email) {
        field.Name = "email";
        field.Type = TType.String;
        field.ID = 4;
        oprot.WriteFieldBegin(field);
        oprot.WriteString(Email);
        oprot.WriteFieldEnd();
      }
      if (__isset.notebookModifiable) {
        field.Name = "notebookModifiable";
        field.Type = TType.Bool;
        field.ID = 5;
        oprot.WriteFieldBegin(field);
        oprot.WriteBool(NotebookModifiable);
        oprot.WriteFieldEnd();
      }
      if (__isset.requireLogin) {
        field.Name = "requireLogin";
        field.Type = TType.Bool;
        field.ID = 6;
        oprot.WriteFieldBegin(field);
        oprot.WriteBool(RequireLogin);
        oprot.WriteFieldEnd();
      }
      if (__isset.serviceCreated) {
        field.Name = "serviceCreated";
        field.Type = TType.I64;
        field.ID = 7;
        oprot.WriteFieldBegin(field);
        oprot.WriteI64(ServiceCreated);
        oprot.WriteFieldEnd();
      }
      if (ShareKey != null && __isset.shareKey) {
        field.Name = "shareKey";
        field.Type = TType.String;
        field.ID = 8;
        oprot.WriteFieldBegin(field);
        oprot.WriteString(ShareKey);
        oprot.WriteFieldEnd();
      }
      if (Username != null && __isset.username) {
        field.Name = "username";
        field.Type = TType.String;
        field.ID = 9;
        oprot.WriteFieldBegin(field);
        oprot.WriteString(Username);
        oprot.WriteFieldEnd();
      }
      if (__isset.serviceUpdated) {
        field.Name = "serviceUpdated";
        field.Type = TType.I64;
        field.ID = 10;
        oprot.WriteFieldBegin(field);
        oprot.WriteI64(ServiceUpdated);
        oprot.WriteFieldEnd();
      }
      if (__isset.privilege) {
        field.Name = "privilege";
        field.Type = TType.I32;
        field.ID = 11;
        oprot.WriteFieldBegin(field);
        oprot.WriteI32((int)Privilege);
        oprot.WriteFieldEnd();
      }
      if (__isset.allowPreview) {
        field.Name = "allowPreview";
        field.Type = TType.Bool;
        field.ID = 12;
        oprot.WriteFieldBegin(field);
        oprot.WriteBool(AllowPreview);
        oprot.WriteFieldEnd();
      }
      if (RecipientSettings != null && __isset.recipientSettings) {
        field.Name = "recipientSettings";
        field.Type = TType.Struct;
        field.ID = 13;
        oprot.WriteFieldBegin(field);
        RecipientSettings.Write(oprot);
        oprot.WriteFieldEnd();
      }
      oprot.WriteFieldStop();
      oprot.WriteStructEnd();
    }

    public override string ToString() {
      StringBuilder sb = new StringBuilder("SharedNotebook(");
      sb.Append("Id: ");
      sb.Append(Id);
      sb.Append(",UserId: ");
      sb.Append(UserId);
      sb.Append(",NotebookGuid: ");
      sb.Append(NotebookGuid);
      sb.Append(",Email: ");
      sb.Append(Email);
      sb.Append(",NotebookModifiable: ");
      sb.Append(NotebookModifiable);
      sb.Append(",RequireLogin: ");
      sb.Append(RequireLogin);
      sb.Append(",ServiceCreated: ");
      sb.Append(ServiceCreated);
      sb.Append(",ServiceUpdated: ");
      sb.Append(ServiceUpdated);
      sb.Append(",ShareKey: ");
      sb.Append(ShareKey);
      sb.Append(",Username: ");
      sb.Append(Username);
      sb.Append(",Privilege: ");
      sb.Append(Privilege);
      sb.Append(",AllowPreview: ");
      sb.Append(AllowPreview);
      sb.Append(",RecipientSettings: ");
      sb.Append(RecipientSettings== null ? "<null>" : RecipientSettings.ToString());
      sb.Append(")");
      return sb.ToString();
    }

  }

}
