import { ResPage, User } from "@/api/interface/index";
import { PORT1 } from "@/api/config/servicePort";
import http from "@/api";

/**
 * @name 用户管理模块
 */

// 系统配置 ！！！！！！！！！！！！！！！！！！
// * 获取用户列表
export const getUserList = (params: User.ReqUserParams) => {
	return http.post<ResPage<User.ResUserList>>(PORT1 + `/xmgl/systemConfig/page`, params);
};

// * 新增用户
export const addUser = (params: FormData) => {
	return http.post(PORT1 + `/xmgl/systemConfig/add`, params);
};

// * 编辑用户
export const editUser = (params: { id: string }) => {
	return http.post(PORT1 + `/xmgl/systemConfig/edit`, params);
};

// * 删除用户
export const deleteUser = (params: { configId: string }) => {
	return http.post(PORT1 + `/xmgl/systemConfig/delete`, params);
};

// 政务管理 ！！！！！！！！！！！！！！！！！！！
export const getGovermentList = (params: User.ReqUserParams) => {
	return http.post<ResPage<User.ResUserList>>(PORT1 + `/xmgl/government/page`, params);
};
// * 新增用户
export const addGovernment = (params: FormData) => {
	return http.post(PORT1 + `/xmgl/government/add`, params);
};
// * 编辑用户
export const editGovernment = (params: { id: string }) => {
	return http.post(PORT1 + `/xmgl/government/edit`, params);
};
export const editGoverCheck = (params: { id: string }) => {
	return http.post(PORT1 + `/xmgl/moduleTemplate/saveOrUpdate`, params);
};
//权限配置多选编辑
// 通过id查询政务以及账号信息
export const getGoverDetail = (params: User.ReqUserParams) => {
	return http.post<ResPage<User.ResUserList>>(PORT1 + `/xmgl/government/queryDetailById`, params);
};
// 列表查询(按模块类型分组)
export const getGoverType = (params: User.ReqUserParams) => {
	return http.post<ResPage<User.ResUserList>>(PORT1 + `/xmgl/baseModule/listByType`, params);
};
// 查询政务下的模块模板信息
export const getGoverForm = (params: User.ReqUserParams) => {
	return http.post<ResPage<User.ResUserList>>(PORT1 + `/xmgl/baseModule/listByGovernment`, params);
};

// 字典 ！！！！！！！！！！！！！！
// 查询
export const getDictionaryList = (params: User.ReqUserParams) => {
	return http.post<ResPage<User.ResUserList>>(PORT1 + `/xmgl/systemDictType/page`, params);
};

// 查询detail
export const getDictionaryDetail = (params: User.ReqUserParams) => {
	return http.post<ResPage<User.ResResults>>(PORT1 + `/xmgl/systemDictData/page`, params);
};
// 查询字典
export const getDicList = (params: User.ReqUserParams) => {
	return http.post<ResPage<User.ResResults>>(PORT1 + `/xmgl/systemDictData/list`, params);
};
// * 新增用户
export const addDictionary = (params: FormData) => {
	return http.post(PORT1 + `/xmgl/systemDictType/add`, params);
};

export const addDiaDictionary = (params: FormData) => {
	return http.post(PORT1 + `/xmgl/systemDictData/add`, params);
};

// * 编辑用户
export const editDictionary = (params: { id: string }) => {
	return http.post(PORT1 + `/xmgl/systemDictType/edit`, params);
};

// * 删除用户
export const deleteDictionary = (params: { id: number }) => {
	return http.post(PORT1 + `/xmgl/systemDictType/delete`, params);
};

//删除字典数据信息
export const deleteDia = (params: { id: number }) => {
	return http.post(PORT1 + `/xmgl/systemDictData/delete`, params);
};

// app管理
export const getAppList = (params: User.ReqUserParams) => {
	return http.post<ResPage<User.ResUserList>>(PORT1 + `/xmgl/appVersion/page`, params);
};
// app增加
export const addApp = (params: FormData) => {
	return http.post(PORT1 + `/xmgl/appVersion/add`, params);
};
// * 编辑app
export const editApp = (params: { id: string }) => {
	return http.post(PORT1 + `/xmgl/appVersion/edit`, params);
};
// 文件下载
export const exportApp = (params: User.ReqUserParams) => {
	return http.download(PORT1 + `/xmgl/file/download`, params);
};

// 菜单管理 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
export const getMenuList = (params: User.ReqUserParams) => {
	return http.post<ResPage<User.ResUserList>>(PORT1 + `/xmgl/baseModule/page`, params);
};
// * 新增用户
export const addMenu = (params: FormData) => {
	return http.post(PORT1 + `/xmgl/baseModule/add`, params);
};
// 添加系统菜单信息
export const addMenubase = (params: FormData) => {
	return http.post(PORT1 + `/xmgl/baseMenu/add`, params);
};
// * 编辑用户
export const editMenu = (params: { id: string }) => {
	return http.post(PORT1 + `/xmgl/baseModule/edit`, params);
};
// * 编辑用户
export const editMenubase = (params: { id: string }) => {
	return http.post(PORT1 + `/xmgl/baseMenu/edit`, params);
};
// 最外层的删除
export const deleteMunu = (params: { id: number }) => {
	return http.post(PORT1 + `/xmgl/baseModule/delete`, params);
};
// 删除系统菜单信息
export const deletesysMenu = (params: { menuId: number }) => {
	return http.post(PORT1 + `/xmgl/baseMenu/delete`, params);
};
// 菜单管理的表格查询
export const menuList = (params: { moduleId: string }) => {
	return http.post<ResPage<User.ResResults>>(PORT1 + `/xmgl/baseMenu/list`, params);
};
// 获取菜单下所有操作  点击按钮管理的table
export const btnList = (params: { moduleId: string }) => {
	return http.post<ResPage<User.ResResults>>(PORT1 + `/xmgl/action/list`, params);
};
// 按钮管理的新增
export const addAction = (params: FormData) => {
	return http.post(PORT1 + `/xmgl/action/add`, params);
};
// 按钮管理的编辑
export const editAction = (params: { actionId: number }) => {
	return http.post(PORT1 + `/xmgl/action/edit`, params);
};
// 删除按钮管理
export const deleteAction = (params: { actionId: number }) => {
	return http.post(PORT1 + `/xmgl/action/delete`, params);
};
