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

#import <Foundation/Foundation.h>
#import "WebQueryParameters.h"
#import "GridData.h"
typedef enum {
    XMLDecoderMessageTypeFault,
    XMLDecoderMessageTypeConfirm,
    XMLDecoderMessageTypeInformation,
    XMLDecoderMessageTypeDeviceOutOfService,
    XMLDecoderMessageTypeDeviceDoesNotExist
}  XMLDecoderMessageType;

@interface XMLDecoder : NSObject

@property (nonatomic) BOOL canHaveNullValues;

- (GridData *)decodeGridResponse:(NSData *)data 
                       withFault:(NSString **)fault
					withMessageType:(XMLDecoderMessageType*)messageType
                     withSession:(NSString **)session;
- (void)decodeConnecterResponse:(NSData *)data
                       withFault:(NSString **)fault
                 withMessageType:(XMLDecoderMessageType*)messageType
                     withSession:(NSString **)session;
- (NSData *)encodeGridRequestwithGrid:(NSString *)gridName
                         withFunction:(NSString *)function
                             withType:(GridQueryType)type
                     withNumberofRows:(long)rows
                  withCurrentPosition:(long)currentPosition
                       withParameters:(WebQueryParameters *)parameters
                        withDataSpyId:(NSString *)dataSpyId;


- (NSArray *)decodeXML:(NSData *)xmlData 
          usingMapping:(NSString *)mapping 
               toModel:(NSString *)model 
               message:(NSString **)message
               session:(NSString **)session
           messageType:(XMLDecoderMessageType*)messageType  exceptionName:(NSString **)exceptionName;

- (NSData *)encodeXMLusingMapping:(NSString *)mapping 
                           object:(id )object 
                       parameters:(WebQueryParameters *)parameters isSync:(BOOL)isSync;


@end
