BBAJSONPredicate.h 1.18 KB
//
//  BBAJSONPredicate.h
//  BBAPods
//
//  Created by Xiong Feng on 15/8/6.
//
//

#import <Foundation/Foundation.h>

@interface BBAJSONPredicate : NSObject

+ (instancetype)predicateWithRules:(NSObject *)rules;

- (instancetype)initWithRules:(NSObject *)rules;

- (BOOL)validateJSON:(__kindof NSObject *)anObject;

@property (nonatomic) BOOL isOptional;

@end

@interface BBAJSONPredicateKeyValue : BBAJSONPredicate

@property (nonatomic, strong) NSString *key;
@property (nonatomic, strong) NSArray *keys;
@property (nonatomic) NSInteger index;
@property (nonatomic, strong) BBAJSONPredicate *predicate;

- (instancetype)initWithKey:(NSObject *)key rules:(NSObject *)rules;
- (BOOL)validateDictionary:(NSDictionary *)aDictionary;
- (BOOL)validateArray:(NSArray *)anArray;

@end

@interface BBAJSONPredicateDictionary : BBAJSONPredicate

@property (nonatomic, strong) NSArray *predicates;

@end

@interface BBAJSONPredicateArray : BBAJSONPredicate

@property (nonatomic, strong) NSArray *predicates;

@end

@interface BBAJsonSimplePredicate : BBAJSONPredicate

@property (nonatomic) char option;

@end

@interface BBAJsonValuePredicate : BBAJSONPredicate

@property (nonatomic, strong) NSArray *values;

@end