//
//  TQNetworkTools.h
//  TQ
//
//  Created by Company on 2020/6/2.
//  Copyright © 2020 Company. All rights reserved.
//

#import <Foundation/Foundation.h>
#import <AFNetworking/AFNetworking.h>
#import <AFNetworking/AFNetworkReachabilityManager.h>

NS_ASSUME_NONNULL_BEGIN

// 请求方式枚举
typedef enum : NSUInteger {
    GET = 0,
    POST = 1
} TQNetworkToolsMethod;

// GET请求动作枚举
typedef enum : NSUInteger {
    userInfo, // 查询用户信息
    appServiceInfo, //各类协议地址
    getIPAPayConfig
    
} TQNetwortGetAction;

// POST请求动作枚举
typedef enum : NSUInteger {
    login,
    touristLogin, //游客登录
    iosIPAVerifyReceipt,
    logCollection, //埋点
} TQNetwortPostAction;

@interface ZTNetworkTools : AFHTTPSessionManager

/// 全局访问点
+ (instancetype)shared;

+ (NSString *)dicToJson:(NSDictionary *)params;

// GET 请求
- (void)getWithAction: (TQNetwortGetAction)action parameters:(id)parameters success: (void(^)(id response))success failure:(void(^)(NSError * error)) failure;

// POST 请求
- (void)postWithAction: (TQNetwortPostAction)action parameters:(id)parameters success: (void(^)(id response))success failure:(void(^)(NSError * error)) failure;

// POST 请求
- (void)postWithAction: (TQNetwortPostAction)action parameters:(id)parameters fileDic:(NSMutableArray *)fileArr progress:(void(^)(id progress))progress success:(void(^)(id response))success failure:(void(^)(NSError * error)) failure;

//支付GET请求
- (void)getWithPayAction: (TQNetwortGetAction)action parameters:(id)parameters success: (void(^)(id response))success failure:(void(^)(NSError * error)) failure;

//服务器验证
- (void)postWithBodyAction: (TQNetwortPostAction)action parameters:(id)parameters body: (id)body success: (void(^)(NSDictionary *response))success failure:(void(^)(NSError * error)) failure;

//埋点
- (void)postWithLogCollection: (TQNetwortPostAction)action parameters:(id) parameters success: (void(^)(id _Nullable * _Nullable response))success failure:(void(^)(NSError * error)) failure;

@end

NS_ASSUME_NONNULL_END
