import request from '/@/utils/request';

export interface MixedReformPayload {
	id?: number | string;
	reportingUnit: string;
	contactPerson: string;
	contactPhone: string;
	groupBelonging: string;
	projectYear: number;
	projectName: string;
	implementEnterprise: string;
	enterpriseCreditCode: string;
	mixedReformMethod: string;
	partnerNature: string;
	isIndustryLeader: string;
	partnerName: string;
	mixedReformType: string;
	progressStatus: string;
	projectStartTime: string;
	estimatedCompletionTime: string;
	actualCompletionTime?: string;
	reformProgress: string;
	mixedCompanyCategory: string;
	mixedCompanyIndustry: string;
	mixedCompanyField: string;
	industryChainCategory: string;
	createBy: string;
	createTime: string;
	updateBy: string;
	updateTime: string;
	delFlag: string;
	processInstanceId: string;
	status: string;
	pushStatus: string;
}

export const addMixedReformAPI = (data: MixedReformPayload) => {
	return request({
		url: '/admin/mixedReform/add',
		method: 'post',
		data,
	});
};
/**根据模板id查询混改*/
export const getMixedReformByTemplateIdAPI = (templateId: string) => {
    return request({
        url: '/admin/mixedReform/getByTemplateId',
        method: 'get',
        params: {
            templateId
        }
    });
}
export interface MixedReformQuery {
	page?: number;
	size?: number;
	projectName?: string;
	implementEnterprise?: string;
	enterpriseCreditCode?: string;
}

export interface MixedReformItem extends MixedReformPayload {
	id: number | string;
}

export interface MixedReformPageResp {
	records: MixedReformItem[];
	total: number;
	page?: number;
	size?: number;
}

export const getMixedReformPageAPI = (data: MixedReformQuery) => {
	return request<MixedReformPageResp>({
		url: '/admin/mixedReform/page',
		method: 'post',
		data,
	});
};

export const getMixedReformDetailAPI = (id: string | number) => {
	return request<MixedReformItem>({
		url: '/admin/mixedReform/view',
		method: 'get',
		params: { id },
	});
};
/**
 * 根据流程实例id查询
 * /admin/mixedReform/getByProcessInstanceId
 * @param processId
 * */
export const getMixedReformByProcessInstanceIdAPI = (processId: string) => {
    return request<MixedReformItem>({
        url: '/admin/mixedReform/getByProcessInstanceId',
        method: 'get',
        params: { processId:processId },
    });
}
