//
//  NvHttpRequest.h
//  NvCheez
//
//  Created by shizhouhu on 2018/6/5.
//  Copyright © 2018年 shizhouhu. All rights reserved.
//

#import <Foundation/Foundation.h>
#import "NvAssetManager.h"
#import "NvAsset.h"

@protocol NvHttpRequestDelegate <NSObject>
@optional

/**
 * 获取到在线素材列表后执行该回调。
 */
- (void)onGetAssetListSuccess:(NSArray *)resultsArray
                    assetType:(AssetType)assetType
                      hasNext:(BOOL)hasNext;

/**
 * 获取到在线素材列表失败执行该回调。
 */
- (void)onGetAssetListFailed:(NSError *)error
                   assetType:(AssetType) assetType;

/**
 * 下载在线素材进度执行该回调。
 */
- (void)onDonwloadAssetProgress:(int32_t)progress
                     downloadID:(NSString*)downloadID;

/**
 * 下载在线素材完成执行该回调。
 */
- (void)onDonwloadAssetSuccess:(BOOL) isSuccess
              downloadFilePath:(NSString*)downloadFilePath
                    downloadID:(NSString*)downloadID;

/**
 * 下载在线素材失败执行该回调。
 */
- (void)onDonwloadAssetFailed:(NSError *) error
             downloadFilePath:(NSString*)downloadFilePath
                   downloadID:(NSString*)downloadID;

/**
 * 检查网络状态后执行该回调。
 */
- (void)onCheckNetworkState:(BOOL)isNetAvailable;

/**
 提交反馈回调

 @param dic 数据
 */
- (void)feedBackWithDictionary:(NSDictionary *)dic;

@end

@interface NvHttpRequest : NSObject

+ (NvHttpRequest *)sharedInstance;

/**
 * 获取到在线素材列表。
 */
- (void)getAssetList:(AssetType)assetType
         aspectRatio:(AspectRatio)aspectRatio
          categoryId:(int)categoryId
               page:(int32_t)page
           pageSize:(int32_t)pageSize
       withDelegate:(id<NvHttpRequestDelegate>)delegate;

/**
 * 下载在线素材。
 */
- (NSURLSessionDownloadTask *)downloadAsset:(NSString*)srcFileUrl
                                 destFileDir:(NSString*)destFileDir
                                withDelegate:(id<NvHttpRequestDelegate>)delegate
                                  downloadID:(NSString*)downloadID;

/**
 * 检查是否存在网络。
 */
- (void)checkNetwork:(id<NvHttpRequestDelegate>)delegate;


/**
 反馈接口

 @param content 反馈内容
 @param contact 联系方式
 @param sdkVersion sdk版本号
 @param deviceModel 手机型号
 */
- (void)feedBackWithContent:(NSString *)content withContact:(NSString *)contact withSdkVersion:(NSString *)sdkVersion withDeviceModel:(NSString *)deviceModel withDelegate:(id<NvHttpRequestDelegate>)delegate;
@end
