//
//  GBaseNetApi.h
//  Pods
//
//  Created by gan on 2025/3/24.
//

#ifndef GBaseNetApi_h
#define GBaseNetApi_h


#endif /* GBaseNetApi_h */
#import "config.h"
typedef void (^GFail)(NSError * _Nonnull error);
typedef void (^GSucc)(int code,NSDictionary * _Nullable __);
typedef void (^UploadProgress)(NSProgress * _Nullable uploadProgress);

typedef void (^FFail)(NSString * _Nullable thrid,NSError * _Nonnull error);
typedef void (^FSucc)(int code,NSString * _Nullable thrid,NSDictionary * _Nullable __);
typedef void (^FUploadProgress)(NSString * _Nullable thrid,NSProgress * _Nullable uploadProgress);

//#define host @"http://203.175.169.52:8080"//测试服务器
//#define host @"http://192.168.1.21:8080"//测试服务器
#define host httphost//生产服务器
#define filehost filehttphost//生产服务器
#define OSSfilehost ossfilehttphost//生产服务器
//#import "ReactiveObjC.h"

@interface GBaseNetApi : NSObject

@property (nonatomic,strong) NSMutableArray * _Nullable uploadTanck;
@property (nonatomic,strong) NSMutableArray * _Nullable downloadTanck;

+ (GBaseNetApi *_Nonnull)shareInstance;

-(void)httpGet:(nullable id)parameters url:(NSString *_Nullable)url succ:(GSucc _Nullable )succ fail:(GFail _Nullable )fail;
-(void)httpPost:(nullable id)parameters url:(NSString *_Nullable)url succ:(GSucc _Nullable )succ fail:(GFail _Nullable )fail;
-(void)httpGetToken:(nullable id)parameters url:(NSString *_Nullable)url succ:(GSucc _Nullable )succ fail:(GFail _Nullable )fail;
-(void)httpPostToken:(nullable id)parameters url:(NSString *_Nullable)url succ:(GSucc _Nullable )succ fail:(GFail _Nullable )fail;

-(void)httpPutToken:(nullable id)parameters url:(NSString *_Nullable)url succ:(GSucc _Nullable )succ fail:(GFail _Nullable )fail;
-(void)httpPatchToken:(nullable id)parameters url:(NSString *_Nullable)url succ:(GSucc _Nullable )succ fail:(GFail _Nullable )fail;

-(void)httpDelToken:(nullable id)parameters url:(NSString *_Nullable)url succ:(GSucc _Nullable )succ fail:(GFail _Nullable )fail;


-(void)upLoadWToken:(NSURL *_Nonnull)filePath succ:(GSucc _Nullable )succ fail:(GFail _Nullable )fail;
-(void)upLoaddataWToken:(NSData *_Nonnull)data fileName:(NSString *_Nullable)fileName succ:(GSucc _Nullable )succ fail:(GFail _Nullable )fail;

///返回上传进度的上传方法
- (void)uploadWithFilePath:(NSURL *_Nullable)filePath thrid:(NSString *_Nullable)thrid progress:(FUploadProgress _Nullable )progress succ:(FSucc _Nullable )succ fail:(FFail _Nullable )fail;
///批量上传
- (void)uploadWithFilePath:(NSArray <NSURL *>*_Nullable)filePaths thrid:(NSString *_Nullable)thrid succ:(FSucc _Nullable )succ fail:(FFail _Nullable )fail;



//OSS返回上传进度的上传方法
- (void)uploadWithFilePathOSS:(NSURL *_Nullable)filePath thrid:(NSString *_Nullable)thrid progress:(FUploadProgress _Nullable )progress succ:(FSucc _Nullable )succ fail:(FFail _Nullable )fail;




-(void)downLoadFileWToken:(NSURL *_Nonnull)url thrid:(NSString *_Nullable)thrid succ:(GSucc _Nullable )succ fail:(GFail _Nullable )fail;

//取消上传
-(void)stopUploadTanck:(NSString *_Nullable)thrid;

@end
