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

#import <Foundation/Foundation.h>
#import "FriendNetApi.h"

@implementation FriendNetApi

//获取好友列表
+(void)getfriends:(NSDictionary *_Nullable)parameters succ:(nullable GSucc)succ fail:(nullable GFail)fail{
    [GBaseNetApi.shareInstance httpGetToken:parameters url:@"/api/sys/friends?state=0" succ:succ fail:fail];
}

//获取黑名单列表
+(void)getblackList:(NSDictionary *_Nullable)parameters succ:(nullable GSucc)succ fail:(nullable GFail)fail{
    [GBaseNetApi.shareInstance httpGetToken:parameters url:@"/api/sys/friends/blackList?" succ:succ fail:fail];
}

//获取待审核好友列表
+(void)getvalidateList:(NSDictionary *_Nullable)parameters succ:(nullable GSucc)succ fail:(nullable GFail)fail{
    [GBaseNetApi.shareInstance httpGetToken:parameters url:@"/api/sys/friends/validateList?" succ:succ fail:fail];
}
//判断是否好友
+(void)isfriend:(NSString *_Nullable)chatId succ:(nullable GSucc)succ fail:(nullable GFail)fail{
    NSString *urlstr=[NSString stringWithFormat:@"/api/sys/friends/isFriend?friendId=%@",chatId];
    [GBaseNetApi.shareInstance httpGetToken:nil url:urlstr succ:succ fail:fail];
}

//查找以便添加好友
+(void)searchfriend:(NSString *_Nullable)keyword succ:(nullable GSucc)succ fail:(nullable GFail)fail{
    NSString *urlstr=[NSString stringWithFormat:@"/api/sys/users/search?mobile=%@",keyword];
    [GBaseNetApi.shareInstance httpGetToken:nil url:urlstr succ:succ fail:fail];
}


//申请添加好友
+(void)shenqingADDfriend:(NSDictionary *_Nullable)parameters succ:(nullable GSucc)succ fail:(nullable GFail)fail{
    [GBaseNetApi.shareInstance httpPostToken:parameters url:@"/api/sys/friends/add?" succ:succ fail:fail];
}

//同意添加好友
+(void)agreeADDfriend:(NSString *_Nullable)userId succ:(nullable GSucc)succ fail:(nullable GFail)fail{
    NSString *urlstr=[NSString stringWithFormat:@"/api/sys/friends/agreeApply?userId=%@",userId];
    [GBaseNetApi.shareInstance httpGetToken:nil url:urlstr succ:succ fail:fail];
}

//拒绝添加好友
+(void)refuseADDfriend:(NSString *_Nullable)friendId succ:(nullable GSucc)succ fail:(nullable GFail)fail{
    NSString *urlstr=[NSString stringWithFormat:@"/api/sys/friends/delFriend?friendId=%@",friendId];
    [GBaseNetApi.shareInstance httpGetToken:nil url:urlstr succ:succ fail:fail];
}

//删除好友
+(void)deletefriend:(NSString *_Nullable)friendId succ:(nullable GSucc)succ fail:(nullable GFail)fail{
    NSString *urlstr=[NSString stringWithFormat:@"/api/sys/friends/delFriend?friendId=%@",friendId];
    [GBaseNetApi.shareInstance httpGetToken:nil url:urlstr succ:succ fail:fail];
}

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

+(void)saveNoDisturbSetting:(NSDictionary *_Nullable)parameters succ:(nullable GSucc)succ fail:(nullable GFail)fail{
    [GBaseNetApi.shareInstance httpPostToken:parameters url:@"/api/sys/immunity" succ:succ fail:fail];
}

+(void)cancelNoDisturbSettingWithUserId:(NSString *_Nullable)userId chatId:(NSString *_Nullable)chatId succ:(nullable GSucc)succ fail:(nullable GFail)fail{
    NSString *urlstr=[NSString stringWithFormat:@"/api/sys/immunity/%@-%@",userId,chatId];
    [GBaseNetApi.shareInstance httpDelToken:nil url:urlstr succ:succ fail:fail];
}

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

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

+(void)reportUser:(NSDictionary *_Nullable)parameters succ:(nullable GSucc)succ fail:(nullable GFail)fail{
    [GBaseNetApi.shareInstance httpPostToken:parameters url:@"/system/user/report" succ:succ fail:fail];
}

@end
