/**
 * Autogenerated by Thrift
 *
 * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
 *  @generated
 */

/**
* @generated by https://github.com/korovkin/thrift
*/

#import <Foundation/Foundation.h>

#import <thrift/TProtocol.h>
#import <thrift/TApplicationException.h>
#import <thrift/TProtocolException.h>
#import <thrift/TProtocolUtil.h>
#import <thrift/TProcessor.h>
#import <thrift/TObjective-C.h>
#import <thrift/TBase.h>
#import <thrift/TBaseStruct.h>

#import "includes.h"


@implementation includesConstants
+ (void) initialize {
}
@end

@implementation Included

- (instancetype) init
{
  self = [super init];
  self.MyIntField = 0;

  return self;
}

- (id) initWithMyIntField: (int64_t) MyIntField
{
  self = [super init];
  __thrift_MyIntField = MyIntField;
  __thrift_MyIntField_set = YES;
  return self;
}

- (id) initWithCoder: (NSCoder *) decoder
{
  self = [super init];
  if ([decoder containsValueForKey: @"MyIntField"])
  {
    __thrift_MyIntField = [decoder decodeInt64ForKey: @"MyIntField"];
    __thrift_MyIntField_set = YES;
  }
  return self;
}

- (void) encodeWithCoder: (NSCoder *) encoder
{
  if (__thrift_MyIntField_set)
  {
    [encoder encodeInt64: __thrift_MyIntField forKey: @"MyIntField"];
  }
}

- (int64_t) MyIntField {
  return __thrift_MyIntField;
}

- (void) setMyIntField: (int64_t) MyIntField {
  [self throwExceptionIfImmutable];
  __thrift_MyIntField = MyIntField;
  __thrift_MyIntField_set = YES;
}

- (BOOL) MyIntFieldIsSet {
  return __thrift_MyIntField_set;
}

- (void) unsetMyIntField {
  __thrift_MyIntField_set = NO;
}

- (void) read: (id <TProtocol>) inProtocol
{
  NSString * fieldName;
  int fieldType;
  int fieldID;

  [inProtocol readStructBeginReturningName: NULL];
  while (true)
  {
    [inProtocol readFieldBeginReturningName: &fieldName type: &fieldType fieldID: &fieldID];
    if (fieldType == TType_STOP) { 
      break;
    }
    switch (fieldID)
    {
      case 1:
        if (fieldType == TType_I64) {
          int64_t fieldValue = [inProtocol readI64];
          [self setMyIntField: fieldValue];
        } else { 
          [TProtocolUtil skipType: fieldType onProtocol: inProtocol];
        }
        break;
      default:
        [TProtocolUtil skipType: fieldType onProtocol: inProtocol];
        break;
    }
    [inProtocol readFieldEnd];
  }
  [inProtocol readStructEnd];
}

- (void) write: (id <TProtocol>) outProtocol {
  [outProtocol writeStructBeginWithName: @"Included"];
  if (__thrift_MyIntField_set) {
    [outProtocol writeFieldBeginWithName: @"MyIntField" type: TType_I64 fieldID: 1];
    [outProtocol writeI64: __thrift_MyIntField];
    [outProtocol writeFieldEnd];
  }
  [outProtocol writeFieldStop];
  [outProtocol writeStructEnd];
}

- (void) validate {
  // check for required fields
}

- (NSString *) description {
  return [[self toDict] description];
}

- (NSDictionary *) toDict {
  NSMutableDictionary *ret = [NSMutableDictionary dictionary];
  ret[@"__thrift_struct_name"] = @"Included";
  ret[@"MyIntField"] = @(__thrift_MyIntField);
  return [ret copy];
}

- (BOOL) makeImmutable {
  const BOOL wasImmutable = [self isImmutable];
  if (!wasImmutable) {
    [super makeImmutable];
  }
  return YES;
}

- (id) mutableCopyWithZone:(NSZone *)zone {
  Included *newCopy = [[[self class] alloc] init];;
  newCopy->__thrift_MyIntField = self->__thrift_MyIntField;
  newCopy->__thrift_MyIntField_set = self->__thrift_MyIntField_set;
  return newCopy;
}

@end

