import { id } from 'element-plus/es/locale';
import { request } from '/@/utils/service';
import { UserPageQuery, AddReq, DelReq, EditReq, InfoReq } from '@fast-crud/fast-crud';

export const apiPrefix = '/api/system/approval/workflow_step/';

export function GetList(query: UserPageQuery) {
	return request({
		url: apiPrefix,
		method: 'get',
		params: query,
	});
}

export function GetObj(id: InfoReq) {
	return request({
		url: apiPrefix + id,
		method: 'get',
	});
}

export function AddObj(obj: AddReq) {
	return request({
		url: apiPrefix,
		method: 'post',
		data: obj,
	});
}

export function UpdateObj(obj: EditReq) {
	return request({
		url: '/api/system/approval/workflow/' + obj.id + '/',
		method: 'put',
		data: obj,
	});
}

export function DelObj(id: DelReq) {
	return request({
		url: apiPrefix + id + '/',
		method: 'delete',
		data: { id },
	});
}

export function switchTenant(tenantId: string) {
	return request({
		url: '/api/system/tenant/switch/',
		method: 'post',
		data: { tenant_id: tenantId },
	});
}

export function GetDeviceClassList() {
	return request({
		url: "/api/system/device/category/",
		method: 'get',
	});
}

//获取学院领导信息
export function GetCollegeLeadershipList() {
	return request({
		url: "/api/system/app_user/?user_type=3",
		method: 'get',
	});
}

/* 获取详情 */

export function GetInfo(id: InfoReq) {
	return request({
		url: "/api/system/approval/workflow_step/?workflow_id="+id,
		method: 'get',
	});
}

// 获取角色列表
export function GetRoleList(query: UserPageQuery) {
	return request({
		url: '/api/system/role/',
		method: 'get',
		params: query,
	});
}
