/**
 * 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 NoteList : TBase
  {
    private int _startIndex;
    private int _totalNotes;
    private List<Evernote.EDAM.Type.Note> _notes;
    private List<string> _stoppedWords;
    private List<string> _searchedWords;
    private int _updateCount;

    public int StartIndex
    {
      get
      {
        return _startIndex;
      }
      set
      {
        __isset.startIndex = true;
        this._startIndex = value;
      }
    }

    public int TotalNotes
    {
      get
      {
        return _totalNotes;
      }
      set
      {
        __isset.totalNotes = true;
        this._totalNotes = value;
      }
    }

    public List<Evernote.EDAM.Type.Note> Notes
    {
      get
      {
        return _notes;
      }
      set
      {
        __isset.notes = true;
        this._notes = value;
      }
    }

    public List<string> StoppedWords
    {
      get
      {
        return _stoppedWords;
      }
      set
      {
        __isset.stoppedWords = true;
        this._stoppedWords = value;
      }
    }

    public List<string> SearchedWords
    {
      get
      {
        return _searchedWords;
      }
      set
      {
        __isset.searchedWords = true;
        this._searchedWords = value;
      }
    }

    public int UpdateCount
    {
      get
      {
        return _updateCount;
      }
      set
      {
        __isset.updateCount = true;
        this._updateCount = value;
      }
    }


    public Isset __isset;
    #if !SILVERLIGHT && !NETFX_CORE
    [Serializable]
    #endif
    public struct Isset {
      public bool startIndex;
      public bool totalNotes;
      public bool notes;
      public bool stoppedWords;
      public bool searchedWords;
      public bool updateCount;
    }

    public NoteList() {
    }

    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.I32) {
              StartIndex = iprot.ReadI32();
            } else { 
              TProtocolUtil.Skip(iprot, field.Type);
            }
            break;
          case 2:
            if (field.Type == TType.I32) {
              TotalNotes = iprot.ReadI32();
            } else { 
              TProtocolUtil.Skip(iprot, field.Type);
            }
            break;
          case 3:
            if (field.Type == TType.List) {
              {
                Notes = new List<Evernote.EDAM.Type.Note>();
                TList _list48 = iprot.ReadListBegin();
                for( int _i49 = 0; _i49 < _list48.Count; ++_i49)
                {
                  Evernote.EDAM.Type.Note _elem50 = new Evernote.EDAM.Type.Note();
                  _elem50 = new Evernote.EDAM.Type.Note();
                  _elem50.Read(iprot);
                  Notes.Add(_elem50);
                }
                iprot.ReadListEnd();
              }
            } else { 
              TProtocolUtil.Skip(iprot, field.Type);
            }
            break;
          case 4:
            if (field.Type == TType.List) {
              {
                StoppedWords = new List<string>();
                TList _list51 = iprot.ReadListBegin();
                for( int _i52 = 0; _i52 < _list51.Count; ++_i52)
                {
                  string _elem53 = null;
                  _elem53 = iprot.ReadString();
                  StoppedWords.Add(_elem53);
                }
                iprot.ReadListEnd();
              }
            } else { 
              TProtocolUtil.Skip(iprot, field.Type);
            }
            break;
          case 5:
            if (field.Type == TType.List) {
              {
                SearchedWords = new List<string>();
                TList _list54 = iprot.ReadListBegin();
                for( int _i55 = 0; _i55 < _list54.Count; ++_i55)
                {
                  string _elem56 = null;
                  _elem56 = iprot.ReadString();
                  SearchedWords.Add(_elem56);
                }
                iprot.ReadListEnd();
              }
            } else { 
              TProtocolUtil.Skip(iprot, field.Type);
            }
            break;
          case 6:
            if (field.Type == TType.I32) {
              UpdateCount = 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("NoteList");
      oprot.WriteStructBegin(struc);
      TField field = new TField();
      if (__isset.startIndex) {
        field.Name = "startIndex";
        field.Type = TType.I32;
        field.ID = 1;
        oprot.WriteFieldBegin(field);
        oprot.WriteI32(StartIndex);
        oprot.WriteFieldEnd();
      }
      if (__isset.totalNotes) {
        field.Name = "totalNotes";
        field.Type = TType.I32;
        field.ID = 2;
        oprot.WriteFieldBegin(field);
        oprot.WriteI32(TotalNotes);
        oprot.WriteFieldEnd();
      }
      if (Notes != null && __isset.notes) {
        field.Name = "notes";
        field.Type = TType.List;
        field.ID = 3;
        oprot.WriteFieldBegin(field);
        {
          oprot.WriteListBegin(new TList(TType.Struct, Notes.Count));
          foreach (Evernote.EDAM.Type.Note _iter57 in Notes)
          {
            _iter57.Write(oprot);
            oprot.WriteListEnd();
          }
        }
        oprot.WriteFieldEnd();
      }
      if (StoppedWords != null && __isset.stoppedWords) {
        field.Name = "stoppedWords";
        field.Type = TType.List;
        field.ID = 4;
        oprot.WriteFieldBegin(field);
        {
          oprot.WriteListBegin(new TList(TType.String, StoppedWords.Count));
          foreach (string _iter58 in StoppedWords)
          {
            oprot.WriteString(_iter58);
            oprot.WriteListEnd();
          }
        }
        oprot.WriteFieldEnd();
      }
      if (SearchedWords != null && __isset.searchedWords) {
        field.Name = "searchedWords";
        field.Type = TType.List;
        field.ID = 5;
        oprot.WriteFieldBegin(field);
        {
          oprot.WriteListBegin(new TList(TType.String, SearchedWords.Count));
          foreach (string _iter59 in SearchedWords)
          {
            oprot.WriteString(_iter59);
            oprot.WriteListEnd();
          }
        }
        oprot.WriteFieldEnd();
      }
      if (__isset.updateCount) {
        field.Name = "updateCount";
        field.Type = TType.I32;
        field.ID = 6;
        oprot.WriteFieldBegin(field);
        oprot.WriteI32(UpdateCount);
        oprot.WriteFieldEnd();
      }
      oprot.WriteFieldStop();
      oprot.WriteStructEnd();
    }

    public override string ToString() {
      StringBuilder sb = new StringBuilder("NoteList(");
      sb.Append("StartIndex: ");
      sb.Append(StartIndex);
      sb.Append(",TotalNotes: ");
      sb.Append(TotalNotes);
      sb.Append(",Notes: ");
      sb.Append(Notes);
      sb.Append(",StoppedWords: ");
      sb.Append(StoppedWords);
      sb.Append(",SearchedWords: ");
      sb.Append(SearchedWords);
      sb.Append(",UpdateCount: ");
      sb.Append(UpdateCount);
      sb.Append(")");
      return sb.ToString();
    }

  }

}
