//
//  LNHttpManager+Relation.swift
//  Lanu
//
//  Created by OneeChan on 2025/12/14.
//

import Foundation


private let kNetPath_Relation_Follow = "/user/follow"
private let kNetPath_Relation_FollowList = "/user/relateion/myFollows"
private let kNetPath_Relation_FansList = "/user/relateion/fans"
private let kNetPath_Relation_Relation = "/user/followRelateions/get"

private let kNetPath_Relation_BlackList_Add = "/im/pullInBlacklist"
private let kNetPath_Relation_BlackList = "/im/myBlacklist"

extension LNHttpManager {
    func operateFollow(uid: String, follow: Bool, completion: @escaping (LNHttpError?) -> Void) {
        post(path: kNetPath_Relation_Follow, params: [
            "userNo": uid,
            "follow": follow
        ], completion: completion)
    }
    
    func blackListUser(uid: String, black: Bool, completion: @escaping (LNHttpError?) -> Void) {
        post(path: kNetPath_Relation_BlackList_Add, params: [
            "userNo": uid,
            "black": black
        ], completion: completion)
    }
    
    func getBlackList(size: Int, next: String, completion: @escaping (LNUserBlackListResponse?, LNHttpError?) -> Void) {
        post(path: kNetPath_Relation_BlackList, params: [
            "size": size,
            "next": next
        ], completion: completion)
    }
}

extension LNHttpManager {
    func getUserFollowList(size: Int, next: String,
                           completion: @escaping (LNUserFollowListResponse?, LNHttpError?) -> Void) {
        post(path: kNetPath_Relation_FollowList, params: [
            "size": size,
            "next": next
        ], completion: completion)
    }
    
    func getUserFansList(size: Int, next: String,
                         completion: @escaping (LNUserFansListResponse?, LNHttpError?) -> Void) {
        post(path: kNetPath_Relation_FansList, params: [
            "size": size,
            "next": next
        ], completion: completion)
    }
    
    func getRelationWithUser(uid: String, completion: @escaping (LNUserRelationRespones?, LNHttpError?) -> Void) {
        post(path: kNetPath_Relation_Relation, params: [
            "userNos": [uid]
        ], completion: completion)
    }
}
