/**
 * 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 Data : TBase
  {
    private byte[] _bodyHash;
    private int _size;
    private byte[] _body;

    public byte[] BodyHash
    {
      get
      {
        return _bodyHash;
      }
      set
      {
        __isset.bodyHash = true;
        this._bodyHash = value;
      }
    }

    public int Size
    {
      get
      {
        return _size;
      }
      set
      {
        __isset.size = true;
        this._size = value;
      }
    }

    public byte[] Body
    {
      get
      {
        return _body;
      }
      set
      {
        __isset.body = true;
        this._body = value;
      }
    }


    public Isset __isset;
    #if !SILVERLIGHT && !NETFX_CORE
    [Serializable]
    #endif
    public struct Isset {
      public bool bodyHash;
      public bool size;
      public bool body;
    }

    public Data() {
    }

    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) {
              BodyHash = iprot.ReadBinary();
            } else { 
              TProtocolUtil.Skip(iprot, field.Type);
            }
            break;
          case 2:
            if (field.Type == TType.I32) {
              Size = iprot.ReadI32();
            } else { 
              TProtocolUtil.Skip(iprot, field.Type);
            }
            break;
          case 3:
            if (field.Type == TType.String) {
              Body = iprot.ReadBinary();
            } 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("Data");
      oprot.WriteStructBegin(struc);
      TField field = new TField();
      if (BodyHash != null && __isset.bodyHash) {
        field.Name = "bodyHash";
        field.Type = TType.String;
        field.ID = 1;
        oprot.WriteFieldBegin(field);
        oprot.WriteBinary(BodyHash);
        oprot.WriteFieldEnd();
      }
      if (__isset.size) {
        field.Name = "size";
        field.Type = TType.I32;
        field.ID = 2;
        oprot.WriteFieldBegin(field);
        oprot.WriteI32(Size);
        oprot.WriteFieldEnd();
      }
      if (Body != null && __isset.body) {
        field.Name = "body";
        field.Type = TType.String;
        field.ID = 3;
        oprot.WriteFieldBegin(field);
        oprot.WriteBinary(Body);
        oprot.WriteFieldEnd();
      }
      oprot.WriteFieldStop();
      oprot.WriteStructEnd();
    }

    public override string ToString() {
      StringBuilder sb = new StringBuilder("Data(");
      sb.Append("BodyHash: ");
      sb.Append(BodyHash);
      sb.Append(",Size: ");
      sb.Append(Size);
      sb.Append(",Body: ");
      sb.Append(Body);
      sb.Append(")");
      return sb.ToString();
    }

  }

}
