//
//  QueryParameters.h
//  EAMiPad
//
//  Created by temp on 1/18/12.
//  Copyright (c) 2012 __MyCompanyName__. All rights reserved.
//

#import <Foundation/Foundation.h>


typedef enum {
    WebQueryParameterOperatorEqual = 0,
    WebQueryParameterOperatorNotEqual,
    WebQueryParameterOperatorContains,
    WebQueryParameterOperatorStartsWith, 
    WebQueryParameterOperatorEndsWith,
    WebQueryParameterOperatorIn,
    WebQueryParameterLessThanEqualTo,
    WebQueryParameterGreaterThanEqualTo,
    WebQueryParameterIsEmpty,
    WebQueryParameterNotEmpty
}  WebQueryParameterOperatorType;


typedef enum {
    GridQueryTypeLov = 0,
    GridQueryTypeList
}  GridQueryType;

typedef enum {
    FilterJoinerAnd = 0,
    FilterJoinerOr
} FilterJoinerType;

typedef enum {
    SortTypeAsc = 0,
    SortTypeDesc
} SortType;


@interface FilterParameters : NSObject 
    
    @property (nonatomic, strong) NSString  *name;
    @property (nonatomic, strong) NSString  *value;
    @property (nonatomic, assign) WebQueryParameterOperatorType  operatorType;
    @property (nonatomic, assign) FilterJoinerType  joinerType;
    @property (nonatomic, assign) BOOL lparen;
    @property (nonatomic, assign) BOOL rparen;
    @property (nonatomic, assign) int seqNum;

@end
    
    
@interface WebQueryParameters : NSObject

-(void)addFieldWithName:(NSString *)name withValue:(id)value;
-(void)addOptionalParameterWithName:(NSString *)name withValue:(id)value withType:(NSString *)type;
-(void)addFilterWithName:(NSString *)name withValue:(NSString *)value;
-(void)addFilterWithName:(NSString *)name withValue:(NSString *)value withOperator:(WebQueryParameterOperatorType)operator;
-(void)addFilterWithName:(NSString *)name withValue:(NSString *)value withOperator:(WebQueryParameterOperatorType)operator withJoiner:(FilterJoinerType)joiner withLParen:(BOOL)lparen withRParen:(BOOL)rparen withSeqNum:(int)seqNum;
- (void)addSortWithName:(NSString *)name withSortType:(SortType)sortType;
- (void)updateFilterWithName:(NSString *)name withValue:(NSString *)value withOperator:(WebQueryParameterOperatorType )operator;

- (void)updateFieldWithName:(NSString *)name withValue:(id)value;


-(void)deleteFilterWithName:(NSString *)name;

-(NSDictionary *)getFields;
-(NSDictionary *)getOptionalParameters;
-(NSArray *)getFilterParameters;
-(NSArray *)getSortParameters;
-(void)setDownloadFileName:(NSString *)fileName;
-(NSString *)getDownloadFileName;

@end
