PNObject/Pod/Classes/PNObject.h
2016-04-06 13:19:55 +02:00

79 lines
1.7 KiB
Objective-C

//
// PNObject.h
// Pods
//
// Created by Giuseppe Nucifora on 28/12/15.
//
//
#import <Foundation/Foundation.h>
#import "PNObjectConfig.h"
#import "PNObjectModel.h"
#import "PNObjectUtilities.h"
#pragma mark MappingSelector Keys
extern NSString* _Nonnull const PNObjectMappingKey;
extern NSString* _Nonnull const PNObjectMappingType;
extern NSString* _Nonnull const PNObjectMappingSelector;
#pragma mark -
@protocol PNObjectSubclassing <NSObject>
@required
+ (NSDictionary * _Nonnull) objcetMapping;
+ (BOOL) singleInstance;
+ (NSString * _Nonnull) objectEndPoint;
@optional
+ (NSString * _Nonnull ) objectClassName;
@end
@interface PNObject : NSObject
+ (NSString * _Nonnull) PNObjClassName;
+ (NSString * _Nonnull) PNObjEndPoint;
+ (NSArray * _Nonnull) batch:(id _Nonnull)JSON fromLocal:(BOOL) fromLocal;
- (_Nullable instancetype) initWithLocalJSON:( NSDictionary * _Nonnull) JSON;
- (_Nullable instancetype) initWithRemoteJSON:( NSDictionary * _Nonnull) JSON;
- (_Nullable instancetype) initWithJSON:( NSDictionary * _Nonnull) JSON fromLocal:(BOOL) fromLocal;
- (id _Nonnull) saveLocally;
- (BOOL) autoRemoveLocally;
- (NSDictionary * _Nonnull) JSONFormObject;
- (NSDictionary * _Nonnull) reverseMapping;
///--------------------------------------
#pragma mark - PNObject Properties
///--------------------------------------
@property (nonatomic, strong, nonnull) NSString *objID;
/**
* <#Description#>
*/
@property (nonatomic, strong, nonnull) NSString * localObjID;
/**
* <#Description#>
*/
@property (nonatomic, strong, nonnull) NSDate * createdAt;
/**
* <#Description#>
*/
@property (nonatomic, strong, nonnull) NSDictionary * JSONObjectMap;
@end