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

  #if !SILVERLIGHT && !NETFX_CORE
  [Serializable]
  #endif
  public partial class PublicUserInfo : TBase
  {
    private int _userId;
    private string _shardId;
    private Evernote.EDAM.Type.PrivilegeLevel _privilege;
    private string _username;
    private string _noteStoreUrl;
    private string _webApiUrlPrefix;

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

    public string ShardId
    {
      get
      {
        return _shardId;
      }
      set
      {
        __isset.shardId = true;
        this._shardId = value;
      }
    }

    public Evernote.EDAM.Type.PrivilegeLevel Privilege
    {
      get
      {
        return _privilege;
      }
      set
      {
        __isset.privilege = true;
        this._privilege = value;
      }
    }

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

    public string NoteStoreUrl
    {
      get
      {
        return _noteStoreUrl;
      }
      set
      {
        __isset.noteStoreUrl = true;
        this._noteStoreUrl = value;
      }
    }

    public string WebApiUrlPrefix
    {
      get
      {
        return _webApiUrlPrefix;
      }
      set
      {
        __isset.webApiUrlPrefix = true;
        this._webApiUrlPrefix = value;
      }
    }


    public Isset __isset;
    #if !SILVERLIGHT && !NETFX_CORE
    [Serializable]
    #endif
    public struct Isset {
      public bool userId;
      public bool shardId;
      public bool privilege;
      public bool username;
      public bool noteStoreUrl;
      public bool webApiUrlPrefix;
    }

    public PublicUserInfo() {
    }

    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) {
              UserId = iprot.ReadI32();
            } else { 
              TProtocolUtil.Skip(iprot, field.Type);
            }
            break;
          case 2:
            if (field.Type == TType.String) {
              ShardId = iprot.ReadString();
            } else { 
              TProtocolUtil.Skip(iprot, field.Type);
            }
            break;
          case 3:
            if (field.Type == TType.I32) {
              Privilege = (Evernote.EDAM.Type.PrivilegeLevel)iprot.ReadI32();
            } else { 
              TProtocolUtil.Skip(iprot, field.Type);
            }
            break;
          case 4:
            if (field.Type == TType.String) {
              Username = iprot.ReadString();
            } else { 
              TProtocolUtil.Skip(iprot, field.Type);
            }
            break;
          case 5:
            if (field.Type == TType.String) {
              NoteStoreUrl = iprot.ReadString();
            } else { 
              TProtocolUtil.Skip(iprot, field.Type);
            }
            break;
          case 6:
            if (field.Type == TType.String) {
              WebApiUrlPrefix = iprot.ReadString();
            } 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("PublicUserInfo");
      oprot.WriteStructBegin(struc);
      TField field = new TField();
      if (__isset.userId) {
        field.Name = "userId";
        field.Type = TType.I32;
        field.ID = 1;
        oprot.WriteFieldBegin(field);
        oprot.WriteI32(UserId);
        oprot.WriteFieldEnd();
      }
      if (ShardId != null && __isset.shardId) {
        field.Name = "shardId";
        field.Type = TType.String;
        field.ID = 2;
        oprot.WriteFieldBegin(field);
        oprot.WriteString(ShardId);
        oprot.WriteFieldEnd();
      }
      if (__isset.privilege) {
        field.Name = "privilege";
        field.Type = TType.I32;
        field.ID = 3;
        oprot.WriteFieldBegin(field);
        oprot.WriteI32((int)Privilege);
        oprot.WriteFieldEnd();
      }
      if (Username != null && __isset.username) {
        field.Name = "username";
        field.Type = TType.String;
        field.ID = 4;
        oprot.WriteFieldBegin(field);
        oprot.WriteString(Username);
        oprot.WriteFieldEnd();
      }
      if (NoteStoreUrl != null && __isset.noteStoreUrl) {
        field.Name = "noteStoreUrl";
        field.Type = TType.String;
        field.ID = 5;
        oprot.WriteFieldBegin(field);
        oprot.WriteString(NoteStoreUrl);
        oprot.WriteFieldEnd();
      }
      if (WebApiUrlPrefix != null && __isset.webApiUrlPrefix) {
        field.Name = "webApiUrlPrefix";
        field.Type = TType.String;
        field.ID = 6;
        oprot.WriteFieldBegin(field);
        oprot.WriteString(WebApiUrlPrefix);
        oprot.WriteFieldEnd();
      }
      oprot.WriteFieldStop();
      oprot.WriteStructEnd();
    }

    public override string ToString() {
      StringBuilder sb = new StringBuilder("PublicUserInfo(");
      sb.Append("UserId: ");
      sb.Append(UserId);
      sb.Append(",ShardId: ");
      sb.Append(ShardId);
      sb.Append(",Privilege: ");
      sb.Append(Privilege);
      sb.Append(",Username: ");
      sb.Append(Username);
      sb.Append(",NoteStoreUrl: ");
      sb.Append(NoteStoreUrl);
      sb.Append(",WebApiUrlPrefix: ");
      sb.Append(WebApiUrlPrefix);
      sb.Append(")");
      return sb.ToString();
    }

  }

}
