#import <Foundation/Foundation.h>
#import <UIKit/UIKit.h>
#import <EventKit/EventKit.h>
#import <CoreLocation/CoreLocation.h>
#import <AFNetworking/AFURLRequestSerialization.h>
#import <RestKit/RKObjectMapping.h>
#import "Address.h"
#import "CreditCard.h"
#import "WebService.h"

@interface Utility : NSObject

+ (EKEventStore *)sharedEventStore;
+ (NSString *)fullImageNameByLaunchSyntaxFromAsset:(NSString *)setName;

#pragma mark - PERL

+ (NSString *)serverFileUrl:(NSString *)relativePath;
+ (NSString *)perlCgiBin:(NSString *)cgiName;

#pragma mark - AttributedString

+ (NSAttributedString *)attributedDefaultAppendingWithString:(NSString *)string;
+ (NSAttributedString *)attributedPriceWithNumber:(NSNumber *)number currencySymbol:(NSString *)currencySymbol integerDigitsFont:(UIFont *)integerDigitsFont fractionDigitsFont:(UIFont *)fractionDigitsFont textColor:(UIColor *)color; 

#pragma mark - JSON

+ (id)JSONObjectWithXMLString:(NSString *)xmlString objectMapping:(RKObjectMapping *)objectMapping;
// + (void)fillJSONObject:(id)obj objectMapping:(RKObjectMapping *)objectMapping;
+ (id)modelWithJSONObject:(id)object withClass:(Class )modelClass;

#pragma mark - XML

+ (NSString *)normalizeXmlString:(NSString *)xmlString;
+ (NSDictionary *)perlParamXml:(NSString *)string action:(NSString *)action;
+ (NSString *)javaSOAPEnvelope:(NSString *)string name:(NSString *)name namespace:(NSString *)namespace;

#pragma mark - HTML
+ (NSAttributedString *)attributedStringWithHtmlString:(NSString *)htmlString fixAttributes:(NSDictionary *)attributes;
+ (NSString *)securityHtmlString:(NSString *)htmlString;

#pragma mark - URL

+ (BOOL)canBeConvertedToUrlEncodedFromString:(NSString *)string;

#pragma mark - Number

+ (NSString *)currencyStringFromNumber:(CGFloat)currencyNumber currencyCode:(NSString *)currencyCode;
+ (NSString *)currencyStringFromNumber:(CGFloat)currencyNumber currencyCode:(NSString *)currencyCode currencyRate:(CGFloat)currencyRate;

+ (BOOL)isValidPhoneNumber:(NSString *)phoneNumber;
+ (NSString *)formattedPhoneNumber:(NSString *)phoneNumber;
+ (void)callPhoneNumber:(NSString *)phoneNumber;
+ (NSDateFormatter *)RANGECALENDAR_DATE_FORMAT;

#pragma mark - Date

+ (NSString *)localizedStringWithDate:(NSDate *)date;
+ (NSString *)localizedStringWithStandardDateString:(NSString *)string;
+ (NSString *)localizedStringWithDatetime:(NSDate *)datetime;
+ (NSString *)localizedStringWithStandardDatetimeString:(NSString *)string;
+ (NSString *)abbreviatedDurationStringFromDate:(NSDate *)fromDate toDate:(NSDate *)toDate;
+ (CGFloat )abbreviatedDurationTimeFromDate:(NSDate *)fromDate toDate:(NSDate *)toDate;

#pragma mark - Graphics

+ (UIColor *)lowestPriceColor;
+ (UIColor *)defaultTitleColor;
+ (UIColor *)defaultSubTitleColor;
+ (UIColor *)popoverViewBackGroundColor;
#pragma mark - Network

+ (id)getTextFromRequestWithMethod:(NSString *)method url:(NSString *)url parameters:(NSDictionary *)parameters success:(void (^)(NSString *text))success;
+ (id)getTextFromRequestWithMethod:(NSString *)method url:(NSString *)url parameters:(NSDictionary *)parameters success:(void (^)(NSString *text)) success error:(void (^)(NSError *error))error;
+ (id)getTextFromRequestWithMethod:(NSString *)method url:(NSString *)url parameters:(NSDictionary *)parameters beforeSend:(void (^)(void)) beforeSend success:(void (^)(NSString *text)) success complete:(void (^)(void))complete;
+ (id)getTextFromRequestWithMethod:(NSString *)method url:(NSString *)url parameters:(NSDictionary *)parameters beforeSend:(void (^)(void)) beforeSend success:(void (^)(NSString *text)) success error:(void (^)(NSError *error)) error complete:(void (^)(void))complete;

+ (id)getXMLFromRequestWithMethod:(NSString *)method url:(NSString *)url parameters:(NSDictionary *)parameters success:(void (^)(NSString *xml))success;
+ (id)getXMLFromRequestWithMethod:(NSString *)method url:(NSString *)url parameters:(NSDictionary *)parameters success:(void (^)(NSString *xml)) success error:(void (^)(NSError *error))error;
+ (id)getXMLFromRequestWithMethod:(NSString *)method url:(NSString *)url parameters:(NSDictionary *)parameters beforeSend:(void (^)(void)) beforeSend success:(void (^)(NSString *xml)) success complete:(void (^)(void))complete;
+ (id)getXMLFromRequestWithMethod:(NSString *)method url:(NSString *)url parameters:(NSDictionary *)parameters beforeSend:(void (^)(void)) beforeSend success:(void (^)(NSString *xml)) success error:(void (^)(NSError *error)) error complete:(void (^)(void))complete;

+ (id)getJSONFromRequestWithMethod:(NSString *)method url:(NSString *)url parameters:(NSDictionary *)parameters success:(void (^)(id jsonObject))success;
+ (id)getJSONFromRequestWithMethod:(NSString *)method url:(NSString *)url parameters:(NSDictionary *)parameters success:(void (^)(NSString *xml)) success error:(void (^)(NSError *error))error;
+ (id)getJSONFromRequestWithMethod:(NSString *)method url:(NSString *)url parameters:(NSDictionary *)parameters beforeSend:(void (^)(void)) beforeSend success:(void (^)(id jsonObject)) success complete:(void (^)(void))complete;
+ (id)getJSONFromRequestWithMethod:(NSString *)method url:(NSString *)url parameters:(NSDictionary *)parameters beforeSend:(void (^)(void)) beforeSend success:(void (^)(id jsonObject)) success error:(void (^)(NSError *error)) error complete:(void (^)(void))complete;

+ (id)performSOAPRequestWithUrl:(NSString *)url namespace:(NSString *)namespace name:(NSString *)name parameters:(NSDictionary *)parameters success:(void (^)(NSString *xml))success;
+ (id)performSOAPRequestWithUrl:(NSString *)url namespace:(NSString *)namespace name:(NSString *)name parameters:(NSDictionary *)parameters success:(void (^)(NSString *xml)) success error:(void (^)(NSError *error))error;
+ (id)performSOAPRequestWithUrl:(NSString *)url namespace:(NSString *)namespace name:(NSString *)name parameters:(NSDictionary *)parameters beforeSend:(void (^)(void)) beforeSend success:(void (^)(NSString *xml)) success complete:(void (^)(void))complete;
+ (id)performSOAPRequestWithUrl:(NSString *)url namespace:(NSString *)namespace name:(NSString *)name parameters:(NSDictionary *)parameters beforeSend:(void (^)(void)) beforeSend success:(void (^)(NSString *xml)) success error:(void (^)(NSError *error)) error complete:(void (^)(void))complete;

+ (id)performRESTRequestWithMethod:(NSString *)method url:(NSString *)url parameters:(NSDictionary *)parameters success:(void (^)(id jsonObject))success;
+ (id)performRESTRequestWithMethod:(NSString *)method url:(NSString *)url parameters:(NSDictionary *)parameters success:(void (^)(id jsonObject)) success error:(void (^)(NSError *error))error;
+ (id)performRESTRequestWithMethod:(NSString *)method url:(NSString *)url parameters:(NSDictionary *)parameters beforeSend:(void (^)(void)) beforeSend success:(void (^)(id jsonObject)) success complete:(void (^)(void))complete;
+ (id)performRESTRequestWithMethod:(NSString *)method url:(NSString *)url parameters:(NSDictionary *)parameters beforeSend:(void (^)(void)) beforeSend success:(void (^)(id jsonObject)) success error:(void (^)(NSError *error)) error complete:(void (^)(void))complete;

+ (id)performUploadMultipartRequestConstructingBodyWithBlock:(void (^)(id <AFMultipartFormData> formData)) block progress:(void (^)(CGFloat uploadProgress)) progressBlock url:(NSString *)url parameters:(NSDictionary *)parameters success:(void (^)(id responseObject))success;
+ (id)performUploadMultipartRequestConstructingBodyWithBlock:(void (^)(id <AFMultipartFormData> formData)) block progress:(void (^)(CGFloat uploadProgress)) progressBlock url:(NSString *)url parameters:(NSDictionary *)parameters success:(void (^)(id responseObject)) success error:(void (^)(NSError *error))error;
+ (id)performUploadMultipartRequestConstructingBodyWithBlock:(void (^)(id <AFMultipartFormData> formData)) block progress:(void (^)(CGFloat uploadProgress)) progressBlock url:(NSString *)url parameters:(NSDictionary *)parameters beforeSend:(void (^)(void)) beforeSend success:(void (^)(id responseObject)) success complete:(void (^)(void))complete;
+ (id)performUploadMultipartRequestConstructingBodyWithBlock:(void (^)(id <AFMultipartFormData> formData)) block progress:(void (^)(CGFloat uploadProgress)) progressBlock url:(NSString *)url parameters:(NSDictionary *)parameters beforeSend:(void (^)(void)) beforeSend success:(void (^)(id responseObject)) success error:(void (^)(NSError *error)) error complete:(void (^)(void))complete;

#pragma mark - View

+ (void)addRoundedBorderToButton:(UIButton *)button;
+ (void)addRoundedBorderToButtons:(NSArray *)buttons;
+ (void)addRoundedBorderToTextView:(UITextView *)textView;
+ (void)addRoundedBorderToView:(UIView *)view;
+ (void)addInsetToFooterViewIfSafeArea:(UIView *)view;

#pragma mark - CoreLocation

+ (void)requestLocationWithCompletion:(void (^)(BOOL granted, CLLocation *location, NSError *error))completion;
+ (void)reverseGeocodeLocation:(CLLocation *)location completionHandler:(void (^)(CLPlacemark *placemark, NSError *error))completionHandler;

#pragma mark - EventKit

+ (BOOL)authorizeCalendarForEvents;
+ (void)saveCalendarEventsForUpcomingItinerariesWithOrders:(NSArray *)orders;

#pragma mark - MessageUI

+ (void)sendFeedback;

#pragma mark - UserNotifications

+ (void)registerRemoteNotificationWithDeviceToken:(NSData *)deviceToken;
+ (void)presentRemoteNotificationInActiveWithPayload:(NSDictionary *)userInfo;
+ (void)changeUserNotificationEnable:(BOOL)enable;


#pragma mark - <ADAppRater>

+ (void)configureRaterFlow;
+ (void)promptRatingOnceFromViewController:(UIViewController *)viewController;

#pragma mark - Custom

+ (NSString *)validationMessageWithContactInfo:(Address *)address;
+ (NSArray *)collectTableViewCellDataArrayWithContactInfo:(Address *)address;

+ (NSString *)validationMessageWithCreditCard:(CreditCard *)creditCard ;
+ (NSArray *)collectTableViewCellDataArrayWithCreditCard:(CreditCard *)creditCard;
+ (NSString *)deviceIdentifier;
@end
