//
//  MPServiceUtils.h
//  StoryboardPlayer
//
//  Created by Andrew Pavlyukov on 7/15/09.
//  Copyright 2009 __MyCompanyName__. All rights reserved.
//

#import <Foundation/Foundation.h>


#define BSLog(fmt, ...) NSLog((@"%@:%d %s: " fmt), ((NSString *)(@__FILE__)).lastPathComponent, __LINE__, __PRETTY_FUNCTION__, ##__VA_ARGS__)
#define BSLogx(fmt, ...)
#define NSLogx(fmt, ...)

#define MPEmptyString @""

static NSString * const MPCGImagePropertyTiffDic = @"{TIFF}";

static NSString * const MPUTTypePSD = @"com.adobe.photoshop-image";


typedef void(^MPSubscribeUserEmailCallbackBlock)(BOOL subscribed);
typedef void(^MPSubscribeUserEmailAndNameCallbackBlock)(BOOL subscribed, NSInteger errorCode);

@interface MPServiceUtils : NSObject

BOOL validateAppStoreReceipt(NSString* bundleIdentifier);

typedef enum _TextFieldType {
    kTextFieldTypePresetName,
    kTextFieldTypeRegular,
    kTextFieldTypePresetCode
} MPTextFieldType;

@property (assign, getter = isAuthorizationAllowed) BOOL authorizationAllowed;

@property (class, readonly) NSBundle *workingBundle;

+ (id)sharedUtils;

- (BOOL)removeFileWithElevatedPrivilegesFromLocation:(NSString *)location;
- (BOOL)copyFileWithElevatedPrivilegesFromPath:(NSString *)from toPath:(NSString*)destination;
- (BOOL)copyLinkWithElevatedPrivilegesFromPath:(NSString *)aSrc toPath:(NSString *)aDst;
- (BOOL)createFolderWithElevatedPrivilegesAtPath:(NSString *)aPath;

- (BOOL)removeQuarantineAttributeForItemAtPath:(NSString *)aPath recursive:(BOOL)aRecursive;

- (NSString *)getPermissionsForItemAtPath:(NSString *)aPath;

- (BOOL)setPermissions:(NSString *)aPermissions forItemAtPath:(NSString *)aPath;

+ (NSDictionary*)dictWithRecieptPath:(NSString*)path;
+ (NSArray*)pathesForBundleID:(NSString*)bundleID;
+ (BOOL)connectedToNetwork;
+ (void)displayDropdownAlertViewWithMessage:(NSString*)message;
+ (NSString*)appDocumentsDir;
+ (NSString*)applicationCashesDirrectory;
+ (NSString*)currentMacAddress;
+ (NSString*)hardwareUUID;
+ (NSString*)appTokenWithSecretKey:(NSString*)secretKey;
+ (NSString*)applicationName;
+ (NSString*)reportAsRunFlagName;
+ (NSString*)fixedApplicationNameInString:(NSString*)string;
+ (BOOL)validateEmail:(NSString*)candidate;
+ (NSString*)hashStringFromString:(NSString*)stringToHash;
+ (void)reportAsRun;
+ (NSString *)buyFullVersionPath;
+ (NSNumber *)applicationUIDKey;
+ (void)buyFullVersion;
+ (void)subscribeUserWithEmail:(NSString*)email completionHandler:(MPSubscribeUserEmailCallbackBlock)subscribed;
+ (void)subscribeUserWithEmail:(NSString*)email approve:(BOOL)approve completionHandler:(MPSubscribeUserEmailCallbackBlock)subscribed;
+ (void)subscribeUserWithEmail:(NSString*)email name:(NSString *)name approve:(BOOL)approve completionHandler:(MPSubscribeUserEmailCallbackBlock)subscribed;


+ (BOOL)syncCanShowEmailCollector;
+ (void)subscribeUserWithName:(NSString *)name email:(NSString *)email url:(NSString *)url completionHandler:(MPSubscribeUserEmailAndNameCallbackBlock)handler;

+ (NSDictionary*)externalProperties;
+ (NSString*)systemVersion;
+ (NSComparisonResult)currentVersionCompare:(NSString*)checkedVersion;
+ (BOOL)useMacAdressForActivation;
+ (void)setUseMacAdressForActivation:(BOOL)useMacAdress;
+ (NSString *)proVersionSuffix;
+ (void)setProVersionSuffix:(NSString *)proVersionSuffix;
+ (BOOL)isRetina;
+ (BOOL)parentScreenIsRetina;
+ (BOOL)hasRetinaScreen;
+ (NSString*)currentLocalization;
+ (NSString *)actualLocalization;
+ (NSArray*)localInAppsIds;
+ (BOOL)isTextFieldStringValid:(NSString*)input forTextFieldType:(MPTextFieldType)type;
+ (CGFloat)backingScaleFactor;
+ (BOOL)needsToShowSmallerSharings;
+ (NSString *)presetPackExtension;
+ (NSString *)containerIdentifier;

+ (BOOL)isLibrawForcedCamera:(NSString *)cameraModel;
+ (BOOL)isLibrawForcedFormat:(NSString *)extension;
+ (BOOL)isLibrawSkippedFormat:(NSString *)extension;
+ (BOOL)isLibrawSkippedCamera:(NSString *)cameraModel;

+ (void)synchronizeExternalProperties;

@end
