//
//  UserNetApi.m
//  TUIContact
//
//  Created by gan on 2025/3/24.
//

#import <Foundation/Foundation.h>

#import "UserNetApi.h"

@implementation UserNetApi



//获取邮箱验证码
+ (void)getEmailcode:(NSString *_Nullable)email succ:(nullable GSucc)succ fail:(nullable GFail)fail{
    NSString *urlstr=[NSString stringWithFormat:@"/getcode?email=%@",email];
    [GBaseNetApi.shareInstance httpGet:nil url:urlstr succ:succ fail:fail];
}

//重置密码获取邮箱验证码
+ (void)getEmailcodereset:(NSString *_Nullable)username succ:(nullable GSucc)succ fail:(nullable GFail)fail{
    NSString *urlstr=[NSString stringWithFormat:@"/getcodeByUsername?username=%@",username];
    [GBaseNetApi.shareInstance httpGet:nil url:urlstr succ:succ fail:fail];
}


//注册
+ (void)sign:(NSDictionary *_Nullable)parameters succ:(nullable GSucc)succ fail:(nullable GFail)fail{
    [GBaseNetApi.shareInstance httpPost:parameters url:@"/register" succ:succ fail:fail];
}

//注销账号
+ (void)zhuxiaozhanghao:(NSDictionary *_Nullable)parameters succ:(nullable GSucc)succ fail:(nullable GFail)fail{
    [GBaseNetApi.shareInstance httpPost:parameters url:@"/delUser" succ:succ fail:fail];
}



//登陆
+ (void)login:(NSDictionary *_Nullable)parameters succ:(GSucc)succ fail:(GFail)fail{
    [GBaseNetApi.shareInstance httpPost:parameters url:@"/login?" succ:succ fail:fail];
}
//安全登录
+ (void)securityLogin:(NSDictionary *)parameters succ:(GSucc)succ fail:(GFail)fail{
    [GBaseNetApi.shareInstance httpPost:parameters url:@"/security/safeLogin" succ:succ fail:fail];
}
//退出登陆
+ (void)logout:(NSDictionary *_Nullable)parameters succ:(nullable GSucc)succ fail:(nullable GFail)fail{
    [GBaseNetApi.shareInstance httpPostToken:nil url:@"/logout?" succ:succ fail:fail];
}

//获取用户信息
+ (void)getUserinfo:(nullable GSucc)succ fail:(nullable GFail)fail{
    [GBaseNetApi.shareInstance httpGetToken:nil url:@"/api/sys/users/my" succ:succ fail:fail];
}

//根据ID获取用户基本信息
+ (void)getUserinfo_id:(NSString *)userid succ:(nullable GSucc)succ fail:(nullable GFail)fail{
    NSString *urlstr=[NSString stringWithFormat:@"/api/sys/users/%@",userid];
    [GBaseNetApi.shareInstance httpGetToken:nil url:urlstr succ:succ fail:fail];
}
//设置用户信息
+ (void)setUserinfo:(NSDictionary *_Nullable)parameters succ:(nullable GSucc)succ fail:(nullable GFail)fail{
    [GBaseNetApi.shareInstance httpPost:parameters url:@"/system/user/setUser" succ:succ fail:fail];
}

//修改密码
+ (void)changePassword:(NSDictionary *_Nullable)parameters succ:(nullable GSucc)succ fail:(nullable GFail)fail{
    [GBaseNetApi.shareInstance httpPutToken:parameters url:@"/api/sys/users/updatePwd" succ:succ fail:fail];
}

//重设密码（/resetPwd）
+ (void)resetPassword:(NSDictionary *_Nullable)parameters succ:(nullable GSucc)succ fail:(nullable GFail)fail{
    [GBaseNetApi.shareInstance httpPost:parameters url:@"/resetPwd" succ:succ fail:fail];
}

//修改用户信息(/api/sys/users/update)
+ (void)changeUserInfo:(NSDictionary *_Nullable)parameters succ:(nullable GSucc)succ fail:(nullable GFail)fail{
    [GBaseNetApi.shareInstance httpPutToken:parameters url:@"/api/sys/users/update" succ:succ fail:fail];
}

//清除 Voip token
+(void)clearVoipTk:(NSDictionary *_Nullable)parameters succ:(nullable GSucc)succ fail:(nullable GFail)fail{
    [GBaseNetApi.shareInstance httpPost:parameters url:@"/system/user/clearVoipTk" succ:succ fail:fail];
    
}
//清除 推送 token
+(void)clearRegistrationId:(NSDictionary *_Nullable)parameters succ:(nullable GSucc)succ fail:(nullable GFail)fail{
    [GBaseNetApi.shareInstance httpPost:parameters url:@"/system/user/clearRegistrationId" succ:succ fail:fail];
}

///添加至收藏夹
+(void)addFavorites:(NSDictionary *_Nullable)parameters succ:(nullable GSucc)succ fail:(nullable GFail)fail{
    [GBaseNetApi.shareInstance httpPostToken:parameters url:@"/api/sys/collects" succ:succ fail:fail];
}

///收藏夹列表（/api/sys/collects?type=）
+(void)favoritesListWithType:(NSString *)type succ:(nullable GSucc)succ fail:(nullable GFail)fail{
    NSDictionary * param = @{@"type":type};
    [GBaseNetApi.shareInstance httpGetToken:param url:@"/api/sys/collects?messageType=" succ:succ fail:fail];
}

+(void)deleteFavoritesWithId:(NSString *)favoritesId succ:(nullable GSucc)succ fail:(nullable GFail)fail{
    NSString * wholeUrl = [NSString stringWithFormat:@"/api/sys/collects/%@",favoritesId];
    [GBaseNetApi.shareInstance httpDelToken:nil url:wholeUrl succ:succ fail:fail];
}

+(void)getChatSetting:(NSString *_Nullable)userId succ:(nullable GSucc)succ fail:(nullable GFail)fail{
    NSString * wholeUrl = [NSString stringWithFormat:@"/api/sys/setting/%@",userId];
    [GBaseNetApi.shareInstance httpGetToken:nil url:wholeUrl succ:succ fail:fail];
}

+(void)updateChatSetting:(NSDictionary *_Nullable)param succ:(nullable GSucc)succ fail:(nullable GFail)fail{
    [GBaseNetApi.shareInstance httpPutToken:param url:@"/api/sys/setting" succ:succ fail:fail];
}

@end
