//
//  VCSettingsDevicePermissions.h
//  Instashare
//
//  Created by Lukáš Foldýna on 18.02.13.
//  Copyright (c) 2013 Arat. All rights reserved.
//

#import <Foundation/Foundation.h>


@class VCService;

@interface VCDevicePermission : NSObject

- (instancetype) initWithName:(NSString *)name deviceID:(NSString *)deviceID deviceType:(NSString *)deviceType transferPermited:(BOOL)transferPermited;
@property (nonatomic, strong) NSString *name;
@property (nonatomic, strong) NSString *deviceID;
@property (nonatomic, strong) NSString *deviceType;
@property (nonatomic, strong) NSString *applicationType; // app type instashare.free

@property (nonatomic, assign, getter = isTransferPermited) BOOL transferPermited; // if it allows tranfer without verification dialog
@property (nonatomic, readonly) BOOL canChangeTransferPermission;

@property (nonatomic, strong) NSString *pushNotificationToken; // if it allows wakeup app via. push notifications
@property (nonatomic, assign, getter = isNotificationTokenEnabled) BOOL enableNotificationToken;
- (void) requestPushNotificationTokenWithService:(VCService *)service callback:(void (^)(NSError *error))callback;
- (BOOL) canAskServiceForPushNoticationToken:(VCService *)service;

@property (nonatomic, copy) void (^deallocCallback)(VCDevicePermission *permission);

@end


@interface VCDevicePermissions : NSObject

+ (void) setDevicePermissionDefaults:(NSUserDefaults *)userDefaults;
+ (VCDevicePermissions *) sharedInstance;

- (void) add:(VCDevicePermission *)permission;
- (void) update:(VCDevicePermission *)permission;
- (void) remove:(VCDevicePermission *)permission;

@property (nonatomic, strong) NSArray<VCDevicePermission *> *content;

- (VCDevicePermission *) devicePermissionForDeviceID:(NSString *)deviceID;
- (VCDevicePermission *) devicePermissionForDevice:(VCDevicePermission *)permissionDevice;
- (BOOL) isTransferAllowedForDevice:(VCDevicePermission *)permissionDevice;

@end


extern NSString *const VCDeviceApplicationTypeIOSFree;
extern NSString *const VCDeviceApplicationTypeIOSPaid;
extern NSString *const VCDeviceApplicationTypeAndroid;
extern NSString *const VCDeviceApplicationTypeOSX;
extern NSString *const VCDeviceApplicationTypeWindows;
