import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { ProjectSelectionVO, ProjectSelectionForm } from './types';

/** 查询年度入围(项目)列表 */
export function listProjectSelection(query: any): AxiosPromise<ProjectSelectionVO[]> {
    return request({
        url: '/customer/annualFinalization/list',
        method: 'get',
        params: query
    });
}

/** 获取年度入围(项目)详情 */
export function getProjectSelection(id: string | number): AxiosPromise<ProjectSelectionVO> {
    return request({
        url: `/customer/annualFinalization/${id}`,
        method: 'get'
    });
}

/** 新增年度入围(项目) */
export function addProjectSelection(data: ProjectSelectionForm): AxiosPromise<void> {
    return request({
        url: '/customer/annualFinalization',
        method: 'post',
        data: data
    });
}

/** 修改年度入围(项目) */
export function updateProjectSelection(data: ProjectSelectionForm): AxiosPromise<void> {
    return request({
        url: '/customer/annualFinalization',
        method: 'put',
        data: data
    });
}

/** 删除年度入围(项目) */
export function delProjectSelection(id: string | number | (string | number)[]): AxiosPromise<void> {
    return request({
        url: `/customer/annualFinalization/${id}`,
        method: 'delete'
    });
}

/** 权属转移 */
export function transferProjectSelection(data: any): AxiosPromise<void> {
    return request({
        url: '/customer/annualFinalization/transfer',
        method: 'put',
        data: data
    });
}

/** 发布项目进度 */
export function publishProjectProgress(data: { projectId: string | number; content: string }): AxiosPromise<void> {
    return request({
        url: '/customer/annualFinalization/progress',
        method: 'post',
        data
    });
}
