//
//  HWDataManager.h
//  VclustersGemini
//
//  Created by 余衡武 on 2021/11/23.
//  Copyright © 2021 APPLE. All rights reserved.
//

#import <Foundation/Foundation.h>

/**数据持久化*/
NS_ASSUME_NONNULL_BEGIN

@interface HWDataManager : NSObject

#pragma mark NSUserDefaults
/**1、Bool*/
+ (BOOL)getBoolWithKey:(NSString* _Nonnull)key;
+ (void)setBoolWithKey:(NSString* _Nonnull)key value:(BOOL)value;
/**2、NSInteger*/
+ (NSInteger)getIntegerWithKey:(NSString* _Nonnull)key;
+ (void)setIntegerWithKey:(NSString* _Nonnull)key value:(NSInteger)value;
/**3、NSNumber*/
+ (NSNumber *)getNumberWithKey:(NSString* _Nonnull)key;
+ (void)setNumberWithKey:(NSString* _Nonnull)key value:(NSNumber *)value;
/**4、NSString*/
+ (NSString* _Nonnull)getStringWithKey:(NSString* _Nonnull)key;
+ (void)setStringWithKey:(NSString* _Nonnull)key value:(NSString* _Nonnull)value;
/**5、NSObject*/
+ (nullable id)getObjectWithKey:(NSString* _Nonnull)key;
+ (void)setObjectWithKey:(NSString* _Nonnull)key value:(nullable id)value;

#pragma mark Plist
/** Plist - plistFolder plist文件夹路径 */
+ (nullable id)readObjectFromPlistFolder:(NSString *)plistFolder;
+ (void)archiveObject:(nullable id)object toPlistFolder:(NSString *)plistFolder;

/** Plist - plistPath plist文件路径 */
+ (nullable id)readObjectFromPlistPath:(NSString *)plistPath;
+ (void)archiveObject:(nullable id)object toPlistPath:(NSString *)plistPath;

/**
 * @brief 获取设备辅助标签信息
 *
 * @param  account 账号
 *
 * @param  sn 设备唯一标识符
 *
 */
+ (NSString *)pathForDeviceDriftWithAccount:(NSString *)account sn:(NSString *)sn;

#pragma mark 沙盒路径
#define DocumentPath   [NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES) firstObject]
#define CachesPath     [NSSearchPathForDirectoriesInDomains(NSCachesDirectory, NSUserDomainMask, YES) firstObject]

/**截图保存路径*/
#define kPath_ScreenShot [NSString stringWithFormat:@"%@/ScreenShot",CachesPath]
/**浏览器当前窗口索引-ID*/
#define BrowserWindowsCurrentID   @"BrowserWindowsCurrentID"


#pragma mark FMDB数据库 - Model
/**浏览器窗口数据-数据库缓存表名*/
#define DB_BrowserWindows_TableName   @"DB_BrowserWindows_TableName"
/**书签数据-数据库缓存表名*/
#define DB_BookMark_TableName         @"DB_BookMark_TableName"
/**浏览器历史数据-数据库缓存表名*/
#define DB_Bookmark_History_TableName      @"DB_Bookmark_History_TableName"


#pragma mark 自定义方法
+ (instancetype)shareInstance;

/**保存截图保存路径*/
+ (NSString *)writeScreenShotImageToLocal:(UIImage *)image withName:(NSString *)fileName;

/** 读取指定路径下的文件or文件夹 */
+ (NSArray *)getFileOrFolderAtPath:(NSString *)basePath;

/**
 * @brief 获取设备缩略图路劲
 *
 * @param  account 账号
 *  *
 * @param  deviceId 设备唯一标识符
 *
 */
+ (NSString *)pathForDevicePhotoWithAccount:(NSString *)account deviceId:(NSString *)deviceId;

@end

NS_ASSUME_NONNULL_END
