//
//  WKClearPhotoManager.h
//  WKClearPhoto
//
//  Created by ZhangJingHao2345 on 2018/2/28.
//  Copyright © 2018年 ZhangJingHao2345. All rights reserved.
//

#import <Foundation/Foundation.h>
#import <Photos/Photos.h>

typedef NS_ENUM(NSInteger, WKPhotoNotificationStatus) {
    WKPhotoNotificationStatusDefualt  = 0, // 相册变更默认处理
    WKPhotoNotificationStatusClose    = 1, // 相册变更不处理
    WKPhotoNotificationStatusNeed     = 2, // 相册变更主动处理
};

@protocol WKClearPhotoManagerDelegate<NSObject>
@optional
/// 相册变动代理方法
- (void)clearPhotoLibraryDidChange;

@end

@interface WKClearPhotoManager : NSObject

+ (WKClearPhotoManager *)shareManager;

// 开始时间
@property (nonatomic, strong) NSDate *startDate;
// 结束时间
@property (nonatomic, strong) NSDate *endDate;

// 所有的图片资源
@property (nonatomic, strong, readonly) PHFetchResult *fetchResult;

/// 代理
@property (nonatomic, weak) id<WKClearPhotoManagerDelegate> delegate;

/// 变更状态
@property (nonatomic, assign) WKPhotoNotificationStatus notificationStatus;

/// 节约空间
@property (nonatomic, assign) CGFloat similarSize;
/// 相似照片数据 [{date1:[dict1,dict2]}, {date2:[dict3,dict4]}...]
@property (nonatomic, strong, readwrite) NSMutableArray *similarArray;

// 形似 live 图片总大小
@property (nonatomic, assign) CGFloat similarLiveSize;
// 形似 live 图
@property (nonatomic, strong, readwrite) NSMutableArray *similarLiveArray;

// 截图图片总大小
@property (nonatomic, assign) CGFloat snapshotSize;
// 截图照片数据
@property (nonatomic, strong, readwrite) NSMutableArray *snapshotArray;

// 视频
@property (nonatomic, strong, readwrite) NSMutableArray *videoArray;

/// 地点
@property (nonatomic, copy) NSMutableArray *locationArray;

/// 加载照片
- (void)loadPhotoWithProcess:(void (^)(NSInteger current, NSInteger total))process
           completionHandler:(void (^)(BOOL success, NSError *error))completion;

/// 删除照片
+ (void)deleteAssets:(NSArray<PHAsset *> *)assets
   completionHandler:(void (^)(BOOL success, NSError *error))completion;

/// 获取原图
+ (void)getOriginImageWithAsset:(PHAsset *)asset
              completionHandler:(void (^)(UIImage *result, NSDictionary *info))completion;

/// 压缩照片
+ (void)compressImageWithData:(NSData *)imageData
            completionHandler:(void (^)(UIImage *compressImg, NSUInteger compresSize))completion;

+ (void)tipWithMessage:(NSString *)str;

// 获取图片
@property (nonatomic, assign) BOOL pauseAction;
@property (nonatomic, assign) NSUInteger currentIndex;
- (void)requestImageWithIndex:(NSInteger)index;


/// 获取位置图片
- (void)loadLocationPhotoWithProcess:(void (^)(NSInteger current, NSInteger total))process
                   completionHandler:(void (^)(BOOL success, NSError *error))completion;
@end
