//
//  _<$managedObjectClassName$>.h
//  Mobile Buy SDK
//
//  Created by Shopify.
//  Copyright (c) 2015 Shopify Inc. All rights reserved.
//
//  Permission is hereby granted, free of charge, to any person obtaining a copy
//  of this software and associated documentation files (the "Software"), to deal
//  in the Software without restriction, including without limitation the rights
//  to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
//  copies of the Software, and to permit persons to whom the Software is
//  furnished to do so, subject to the following conditions:
//
//  The above copyright notice and this permission notice shall be included in
//  all copies or substantial portions of the Software.
//
//  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
//  IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
//  FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
//  AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
//  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
//  OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
//  THE SOFTWARE.
//
// DO NOT EDIT. This file is machine-generated and constantly overwritten.
// Make changes to <$managedObjectClassName$>.h instead.

<$if hasCustomSuperentity$><$if hasSuperentity$>#import <Buy/<$customSuperentity$>.h>
<$else$><$if hasCustomBaseCaseImport$>#import <$baseClassImport$><$else$>#import <Buy/<$customSuperentity$>.h><$endif$><$endif$><$endif$>

<$if hasAdditionalHeaderFile$>
#import <Buy/<$additionalHeaderFileName$>>
<$endif$>
#import <Buy/BUYModelManager.h>

<$if noninheritedAttributes.@count > 0$>
extern const struct <$managedObjectClassName$>Attributes {<$foreach Attribute noninheritedAttributes do$>
	<$if TemplateVar.arc$>__unsafe_unretained<$endif$> NSString *<$Attribute.name$>;<$endforeach do$>
} <$managedObjectClassName$>Attributes;
<$endif$>

<$if noninheritedRelationships.@count > 0$>
extern const struct <$managedObjectClassName$>Relationships {<$foreach Relationship noninheritedRelationships do$>
	<$if TemplateVar.arc$>__unsafe_unretained<$endif$> NSString *<$Relationship.name$>;<$endforeach do$>
} <$managedObjectClassName$>Relationships;
<$endif$>

<$if noninheritedFetchedProperties.@count > 0$>
extern const struct <$managedObjectClassName$>FetchedProperties {<$foreach FetchedProperty noninheritedFetchedProperties do$>
	<$if TemplateVar.arc$>__unsafe_unretained<$endif$> NSString *<$FetchedProperty.name$>;<$endforeach do$>
} <$managedObjectClassName$>FetchedProperties;
<$endif$>

<$if hasUserInfoKeys$>
extern const struct <$managedObjectClassName$>UserInfo {<$foreach UserInfo userInfoKeyValues do$>
	<$if TemplateVar.arc$>__unsafe_unretained<$endif$> NSString *<$UserInfo.key$>;<$endforeach do$>
} <$managedObjectClassName$>UserInfo;
<$endif$>

<$foreach Relationship noninheritedRelationships do$>@class <$Relationship.destinationEntity.managedObjectClassName$>;
<$endforeach do$>
<$foreach Attribute noninheritedAttributes do$><$if Attribute.hasTransformableAttributeType$><$if Attribute.objectAttributeTransformableProtocols$>
<$foreach Protocol Attribute.objectAttributeTransformableProtocols do$>@protocol <$Protocol$>;
<$endforeach do$><$else$>
@class <$Attribute.objectAttributeClassName$>;<$endif$><$endif$>
<$endforeach do$>

@class <$managedObjectClassName$>;
@interface BUYModelManager (<$managedObjectClassName$>Inserting)
- (NSArray<<$managedObjectClassName$> *> *)all<$name$>Objects;
- (<$managedObjectClassName$> *)fetch<$name$>WithIdentifierValue:(int64_t)identifier;
- (<$managedObjectClassName$> *)insert<$name$>WithJSONDictionary:(NSDictionary *)dictionary;
- (NSArray<<$managedObjectClassName$> *> *)insert<$name$>sWithJSONArray:(NSArray <NSDictionary *> *)array;
@end

<$if userInfo.documentation$>
/**
 * <$userInfo.documentation$><$if userInfo.discussion$>
 *
 * <$userInfo.discussion$><$endif$>
 */<$endif$>
@interface _<$managedObjectClassName$> : <$customSuperentity$>

+ (NSString *)entityName;

<$foreach Attribute noninheritedAttributes do$>
<$if Attribute.userInfo.documentation$>
/**
 * <$Attribute.userInfo.documentation$><$if Attribute.userInfo.discussion$>
 *
 * <$Attribute.userInfo.discussion$><$endif$>
 */<$endif$><$if Attribute.hasDefinedAttributeType$><$if TemplateVar.arc$><$if Attribute.isReadonly$>
@property (nonatomic, strong, readonly) <$Attribute.objectAttributeType$> <$Attribute.name$>;
<$else$>
@property (nonatomic, strong) <$Attribute.objectAttributeType$> <$Attribute.name$>;
<$endif$>
<$else$>
<$if Attribute.isReadonly$>
@property (nonatomic, retain, readonly) <$Attribute.objectAttributeType$> <$Attribute.name$>;
<$else$>
@property (nonatomic, retain) <$Attribute.objectAttributeType$> <$Attribute.name$>;
<$endif$>
<$endif$>
<$if Attribute.hasScalarAttributeType$>
<$if Attribute.isReadonly$>
@property (atomic, readonly) <$Attribute.scalarAttributeType$> <$Attribute.name$>Value;
- (<$Attribute.scalarAttributeType$>)<$Attribute.name$>Value;
<$else$>
@property (atomic) <$Attribute.scalarAttributeType$> <$Attribute.name$>Value;
- (<$Attribute.scalarAttributeType$>)<$Attribute.name$>Value;
- (void)set<$Attribute.name.initialCapitalString$>Value:(<$Attribute.scalarAttributeType$>)value_;
<$endif$><$endif$><$endif$>
<$endforeach do$>
<$foreach Relationship noninheritedRelationships do$>
<$if Relationship.userInfo.documentation$>
/**
 * <$Relationship.userInfo.documentation$><$if Relationship.userInfo.discussion$>
 *
 * <$Relationship.userInfo.discussion$><$endif$>
 */<$endif$><$if Relationship.isToMany$><$if TemplateVar.arc$>
@property (nonatomic, strong) <$Relationship.immutableCollectionClassName$> *<$Relationship.name$>;
<$else$>
@property (nonatomic, retain) <$Relationship.immutableCollectionClassName$> *<$Relationship.name$>;
<$endif$>
- (<$Relationship.mutableCollectionClassName$>*)<$Relationship.name$>Set;
<$else$><$if TemplateVar.arc$>
@property (nonatomic, strong) <$Relationship.destinationEntity.managedObjectClassName$> *<$Relationship.name$>;
<$else$>
@property (nonatomic, retain) <$Relationship.destinationEntity.managedObjectClassName$> *<$Relationship.name$>;
<$endif$><$endif$>
<$endforeach do$>
<$foreach FetchedProperty noninheritedFetchedProperties do$>
<$if FetchedProperty.userInfo.documentation$>
/**
 * <$FetchedProperty.userInfo.documentation$><$if FetchedProperty.userInfo.discussion$>
 *
 * <$FetchedProperty.userInfo.discussion$><$endif$>
 */<$endif$>
@property (nonatomic, readonly) NSArray *<$FetchedProperty.name$>;
<$endforeach do$>
<$if TemplateVar.frc$>
#if TARGET_OS_IPHONE
<$foreach Relationship noninheritedRelationships do$>
<$if Relationship.isToMany$>
- (NSFetchedResultsController *)new<$Relationship.name.initialCapitalString$>FetchedResultsControllerWithSortDescriptors:(NSArray *)sortDescriptors;
<$endif$>
<$endforeach do$>
#endif
<$endif$>
@end

<$foreach Relationship noninheritedRelationships do$>
<$if Relationship.isToMany$>

@interface _<$managedObjectClassName$> (<$Relationship.name.initialCapitalString$>CoreDataGeneratedAccessors)
<$if Relationship.isOrdered$>
- (void)insertObject:(<$Relationship.destinationEntity.managedObjectClassName$>*)value in<$Relationship.name.initialCapitalString$>AtIndex:(NSUInteger)idx;
- (void)removeObjectFrom<$Relationship.name.initialCapitalString$>AtIndex:(NSUInteger)idx;
- (void)insert<$Relationship.name.initialCapitalString$>:(NSArray *)value atIndexes:(NSIndexSet *)indexes;
- (void)remove<$Relationship.name.initialCapitalString$>AtIndexes:(NSIndexSet *)indexes;
- (void)replaceObjectIn<$Relationship.name.initialCapitalString$>AtIndex:(NSUInteger)idx withObject:(<$Relationship.destinationEntity.managedObjectClassName$>*)value;
- (void)replace<$Relationship.name.initialCapitalString$>AtIndexes:(NSIndexSet *)indexes with<$Relationship.name.initialCapitalString$>:(NSArray *)values;
<$endif$>
@end
<$endif$>
<$endforeach do$>
