import axiosInstance from "@/api/axios.ts";
import type {ILoginUser} from "@/interface/page/user/ILoginUser.ts";
import type {IUserSearch} from "@/interface/page/user/IUserSearch.ts";
import type IUpdateUserData from "@/interface/page/user/IUpdateUserData.ts";
import type IAppUserPo from "@/interface/page/user/IAppUserPo.ts";
import type {ILocalUserData} from "@/interface/page/user/ILocalUserData.ts";

export default class UserApi {

    // 登录接口
    static login(user: ILoginUser) {
        return axiosInstance.post("/app/user/login", user);
    }
    // 获取用户的权限
    static permission() {
        return axiosInstance.get("/app/user/permission");
    }
    // 查询用户列表
    static queryUserList(userSearch: IUserSearch) {
        return axiosInstance.post("/app/user/queryUser", userSearch);
    }
    // 登出用户
    static loginOut(userId: string) {
        return axiosInstance.put("/app/user/logoutUser/" + userId);
    }
    // 更新用户信息
    static updateUser(user: IUpdateUserData) {
        return axiosInstance.post("/app/user/updateUser", user);
    }
    // 删除用户
    static deleteUser(userId: string) {
        return axiosInstance.delete("/app/user/deleteUser/" + userId)
    }
    // 创建用户
    static createUser(user: IAppUserPo) {
        return axiosInstance.post("/app/user/createUser", user);
    }
    // 查询用户菜单，简单版本
    static queryUserMenuPermissionSimpleTree() {
        return axiosInstance.get("/app/user/queryUserMenuPermissionSimpleTree");
    }
    // 修改自己的个人信息
    static updateSelfUser(user: ILocalUserData) {
        return axiosInstance.post("/app/user/updateSelfUser", user);
    }


}