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

export const apiPrefix = '/api/system/approval/workflow/';
export const apipoefixsp='/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(ids:number,obj: EditReq) {
	return request({
		url: '/api/system/approval/workflow_step/' + ids + '/',
		method: 'put',
		data: obj,
	});
}

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





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



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


export function UpdateFirstObj(ids:number,obj: AddReq) {
	return request({
		url: apipoefixsp + ids + '/',
		method: 'put',
		data: obj,
	});
}


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