import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { BackRecordVO, BackRecordQuery, TableDataInfo, BackCheckReportVO } from './types';

/**
 * 查询背调执行记录列表（候选人列表）
 */
export function listBackRecord(params: BackRecordQuery): AxiosPromise<TableDataInfo<BackRecordVO>> {
  return request.get('/system/backRecord/list', { params });
}

/**
 * 查询背调报告详情（表单数据+访谈记录）
 */
export function getBackCheckReport(recordId: string | number): AxiosPromise<BackCheckReportVO> {
  return request({
    url: `/system/backRecord/${recordId}/report`,
    method: 'get'
  });
}

/**
 * 管理端提交背调报告（需登录，含三个核实结果）
 */
export function submitBackCheckReport(recordId: string | number, data: BackCheckReportVO): AxiosPromise<void> {
  return request({
    url: `/system/backRecord/${recordId}/report`,
    method: 'put',
    data
  });
}
