
#import <Foundation/Foundation.h>

typedef NS_ENUM(NSUInteger, YMAuthorizationType) {
    YMAuthorizationTypePhotoLibrary API_AVAILABLE(ios(8.0)),
    YMAuthorizationTypeCamera API_AVAILABLE(ios(7.0)),
    YMAuthorizationTypeMicrophone API_AVAILABLE(ios(7.0)),
    YMAuthorizationTypePush API_AVAILABLE(ios(10.0)),
    YMAuthorizationTypeCalendar API_AVAILABLE(ios(6.0)),
    YMAuthorizationTypeContacts API_AVAILABLE(ios(9.0)),
    //YMAuthorizationTypeLocation API_AVAILABLE(ios(4.2)),
};

typedef NS_ENUM(NSUInteger, YMAuthorizationStatus) {
    YMAuthorizationStatusNotDetermined,// 用户还未选择是否允许授权 可以代表第一次询问
    YMAuthorizationStatusDenied,// 拒绝授权 包括 Restricted & Denied
    YMAuthorizationStatusAuthorized,// 已授权
    YMAuthorizationStatusUnknow,// 未知状态
};

@interface SLAuthorizationManager : NSObject

+ (YMAuthorizationStatus)authorizationStatusForType:(YMAuthorizationType)type;

+ (void)requestAuthorization:(YMAuthorizationType)type grantedBlock:(void (^)(BOOL granted))grantedBlock;

+ (void)requestAuthorization:(YMAuthorizationType)type mainThreadGrantedBlock:(void (^)(BOOL granted))grantedBlock;

@end
