//
//  QSLApi.swift
//  QuickSearchLocation
//
//  Created by Destiny on 2024/12/4.
//

enum QSLEnvironment: Int {
    case local
    case dev
    case prod
}

struct QSLApi {
    
    static let environment = QSLEnvironment.prod
    
    // 本地
    static let LocalUrl = "http://wjj.dy.takin.cc"
    
    // 测试
    static let devUrl = ""
    
    // 正式
    static let prodUrl = "http://loc-api.v8dashen.com"
    
    static let localWSUrl = "ws://192.168.10.53:56389"
    
    static let prodWSUrl = "ws://loc-api.v8dashen.com"
    
    // 中台
    static let centralUrl = "https://project-api.atmob.com"
    
    static let appKey = "c70327c169214b269a6cde5405d9f130"
    
    static var params : [String:Any] = [
        "channelName": "appstore",
        "appPlatform": 2,
        "idfa":"",
        "idfv":"",
        "packageName": "com.manbu.shouhu",
        "appVersionName": "1.0.0",
        "appVersionCode": 100
    ]
    
    // APP 名称
    static var appName = ""
    // 包名
    static var packageName = ""
    // 版本名称
    static var appVersionName = ""
    // idfa
    static var idfa = ""
    // idfv
    static var idfv = ""
    
    static func getAppName(appName: String) {
        self.appName = appName
    }
    
    // 获取包名
    static func getPackageName(packageName: String) {
        params["packageName"] = packageName
        self.packageName = packageName
    }
    
    // 更新IDFA值
    static func getIDFA(newIDFA: String) {
        self.idfa = newIDFA
        params["idfa"] = newIDFA
    }
    
    // 更新IDFV值
    static func getIDFV(newIDFV: String) {
        self.idfv = newIDFV
        params["idfv"] = newIDFV
    }
    
    // 更新app版本值
    static func getAppVersionName(appVersionName: String) {
        params["appVersionName"] = appVersionName
        self.appVersionName = appVersionName
    }

    // 更新app版本Code
    static func getAppVersionCode(appVersionCode: Int) {
        params["appVersionCode"] = appVersionCode
    }
    
    // 更新系统版本
    static func getOSVersion(osVersion: String) {
        params["osVersion"] = osVersion
    }
    
    static func updateToken(token: String) {
        params["authToken"] = token
    }
}

// 用户模块
extension QSLApi {
    
    // 获取手机验证码
    static let user_code = "/s/v1/user/code"
    
    // 获取用户会员状态
    static let user_member = "/s/v1/user/member"
    
    // 手机验证码登录接口
    static let user_login = "/s/v1/user/login"
    
    // 清空用户所有数据
    static let user_clear = "/s/v1/user/clear"
    
    
    // 一键登录
    static let login_oneclick = "/s/v1/user/login/oneclick"
}

// 好友模块
extension QSLApi {
    
    // 根据朋友id查询到朋友
    static let friend_get = "/s/v1/friend/get"
    
    // 好友列表接口
    static let friend_list = "/s/v1/friend/list"
    
    // 删除好友接口
    static let friend_delete = "/s/v1/friend/delete"
    
    // 修改好友备注
    static let friend_remark = "/s/v1/friend/remark"
    
    // 修改是否不让他看
    static let friend_blocked = "/s/v1/friend/blocked"
    
    // 求救好友接口
    static let friend_mayday = "/s/v1/friend/mayday"
    
}

// 好友消息和请求
extension QSLApi {
    
    // 待处理好友请求列表
    static let request_list_waiting = "/s/v1/friend/request/list/waiting"
    
    // 所有好友请求列表
    static let request_list = "/s/v1/friend/request/list"
    
    // 发送好友请求
    static let request_send = "/s/v1/friend/request/send"
    
    // 接受好友请求
    static let request_accept = "/s/v1/friend/request/accept"
    
    // 拒绝好友请求
    static let request_refuse = "/s/v1/friend/request/refuse"
    
    // 消息列表接口
    static let message_list = "/s/v1/friend/message/list"
}

// 支付模块
extension QSLApi {
    
    // 商品列表
    static let vip_item_list = "/s/v1/item/list"
    
    // 创建订单并发起支付
    static let vip_order_submitAndPay = "/s/v1/order/submitAndRequestPay"
    
    // 查询支付结果
    static let vip_order_payStatus = "/s/v1/order/payStatus"
    
    // 恢复订阅
    static let vip_subscription_resume = "/s/v1/subscription/resume"
    
    // 查询订阅状态
    static let vip_subscription_check = "/s/v1/subscription/check"
}

///好评引导模块
extension QSLApi {
    // 是否触发好评引导弹窗
    static let guide_is_triggered = "/s/v1/guide/is/triggered"
    
    // 领取好评引导奖励
    static let guide_receisve_reward = "/s/v1/guide/receive/reward"
}

// 定位模块
extension QSLApi {
    
    // 上传定位
    static let location_upload = "/s/v1/location/upload"
    
    // 获取轨迹
    static let location_track_query = "/s/v1/location/track/query"
}

extension QSLApi {
    
    // 紧急联系人列表
    static let contact_list = "/s/v1/contact/list"
    
    // 新增联系人
    static let contact_create = "/s/v1/contact/create"
    
    // 修改联系人是否为默认
    static let contact_favor = "/s/v1/contact/favor"
    
    // 删除联系人
    static let contact_delete = "/s/v1/contact/delete"
    
    // 向单个紧急联系人求救
    static let contact_mayday = "/s/v1/contact/mayday"
    
    // 向默认紧急联系人求救
    static let contact_mayday_favor = "/s/v1/contact/mayday/favor"
    
    // 向所有紧急联系人求救
    static let contact_mayday_all = "/s/v1/contact/mayday/all"
}

extension QSLApi {
    
    // 客户端上报设备信息
    static let device_info_upload = "/s/v1/client/device/info/upload"
}
