import type { TaskCheckModel, TaskPhotoModel, CompetitorMarketingSurveyModel, CompetitorSalesSurveyModel, TurnInRateSurveyModel, LicenseTaskModel, TeamShiftLogModel, TaskAttachmentModel, FormManagementPlan, FormOperationalWeeklyReport, FormMeetingRecords, TaskCustomerComplaint, FormBusinessPlan, FormParticipationRecord } from './model';

import type { BaseResult } from '#/api/base-result';

import { requestClient } from '#/api/request';

// API路径常量枚举
enum Api {
  // 任务检查记录列表
  taskCheckList = '/taskCheck/check/list',
  // 拍照任务列表
  taskPhotoList = '/taskPhoto/photo/list',
  // 竞争对手营销调查列表
  competitorMarketingSurveyList = '/formCompetitorMarketingSurvey/survey/list',
  // 竟对油站列表
  competitiveStationList = '/gasCompetitiveStation/station/list',
  // 竞争对手销量调查列表
  competitorSalesSurveyList = '/formCompetitorSalesSurvey/survey/list',
  // 拐入率调查列表
  turnInRateSurveyList = '/formTurnInRateSurvey/survey/list',
  // 证照任务管理列表
  licenseTaskList = '/formLicense/license/list',
  // 班组日志列表
  teamShiftLogList = '/formTeamShiftLog/log/list',
  // 收集附件列表
  taskAttachmentList = '/taskAttachment/attachment/list',
  // 管理计划列表
  managementPlanList = '/formManagementPlan/plan/list',
  // 运营周报列表
  operationalWeeklyReportList = '/formOperationalWeeklyReport/report/list',
  // 例会记录列表
  meetingRecordsList = '/formMeetingRecords/records/list',
  // 客户投诉列表
  customerComplaintList = '/taskCustomerComplaint/complaint/list',
  // 客户投诉详情
  customerComplaintDetail = '/taskCustomerComplaint/complaint/',
  // 新增客户投诉
  customerComplaintAdd = '/taskCustomerComplaint/complaint',
  // 修改客户投诉
  customerComplaintUpdate = '/taskCustomerComplaint/complaint',
  // 删除客户投诉
  customerComplaintDelete = '/taskCustomerComplaint/complaint/',
  // 导出客户投诉
  customerComplaintExport = '/taskCustomerComplaint/complaint/export',
  // 经营计划列表
  businessPlanList = '/formBusinessPlan/plan/list',
  // 参与记录列表
  participationRecordList = '/formParticipationRecord/record/list',
}

/**
 * 查询任务检查记录列表
 * @param params 查询参数
 * @returns 任务检查记录列表
 */
export function getTaskCheckList(params: any) {
  return requestClient.get<BaseResult<TaskCheckModel[]>>(Api.taskCheckList, {
    params,
  });
}

/**
 * 查询拍照任务列表
 * @param params 查询参数
 * @returns 拍照任务列表
 */
export function getTaskPhotoList(params: any) {
  return requestClient.get<BaseResult<TaskPhotoModel[]>>(Api.taskPhotoList, {
    params,
  });
}

/**
 * 查询竞争对手营销调查列表
 * @param params 查询参数
 * @returns 竞争对手营销调查列表
 */
export function getCompetitorMarketingSurveyList(params: any) {
  return requestClient.get<BaseResult<CompetitorMarketingSurveyModel[]>>(Api.competitorMarketingSurveyList, {
    params,
  });
}

/**
 * 查询竟对油站列表
 * @param params 查询参数
 * @returns 竟对油站列表
 */
export function getCompetitiveStationList(params: any) {
  return requestClient.get<BaseResult<any[]>>(Api.competitiveStationList, {
    params,
  });
}

/**
 * 查询竞争对手销量调查列表
 * @param params 查询参数
 * @returns 竞争对手销量调查列表
 */
export function getCompetitorSalesSurveyList(params: any) {
  return requestClient.get<BaseResult<CompetitorSalesSurveyModel[]>>(Api.competitorSalesSurveyList, {
    params,
  });
}

/**
 * 查询拐入率调查列表
 * @param params 查询参数
 * @returns 拐入率调查列表
 */
export function getTurnInRateSurveyList(params: any) {
  return requestClient.get<BaseResult<TurnInRateSurveyModel[]>>(Api.turnInRateSurveyList, {
    params,
  });
}

/**
 * 查询证照任务管理列表
 * @param params 查询参数
 * @returns 证照任务管理列表
 */
export function getLicenseTaskList(params: any) {
  return requestClient.get<BaseResult<LicenseTaskModel[]>>(Api.licenseTaskList, {
    params,
  });
}

/**
 * 查询班组日志列表
 * @param params 查询参数
 * @returns 班组日志列表
 */
export function getTeamShiftLogList(params: any) {
  return requestClient.get<BaseResult<TeamShiftLogModel[]>>(Api.teamShiftLogList, {
    params,
  });
}

/**
 * 查询收集附件列表
 * @param params 查询参数
 * @returns 收集附件列表
 */
export function getTaskAttachmentList(params: any) {
  return requestClient.get<BaseResult<TaskAttachmentModel[]>>(Api.taskAttachmentList, {
    params,
  });
}

/**
 * 查询管理计划列表
 * @param params 查询参数
 * @returns 管理计划列表
 */
export function getManagementPlanList(params: any) {
  return requestClient.get<BaseResult<FormManagementPlan[]>>(Api.managementPlanList, {
    params,
  });
}

/**
 * 查询运营周报列表
 * @param params 查询参数
 * @returns 运营周报列表
 */
export function getOperationalWeeklyReportList(params: any) {
  return requestClient.get<BaseResult<FormOperationalWeeklyReport[]>>(Api.operationalWeeklyReportList, {
    params,
  });
}

/**
 * 查询例会记录列表
 * @param params 查询参数
 * @returns 例会记录列表
 */
export function getMeetingRecordsList(params: any) {
  return requestClient.get<BaseResult<FormMeetingRecords[]>>(Api.meetingRecordsList, {
    params,
  });
}

/**
 * 查询客户投诉列表
 * @param params 查询参数
 * @returns 客户投诉列表
 */
export function getCustomerComplaintList(params: any) {
  return requestClient.get<BaseResult<TaskCustomerComplaint[]>>(Api.customerComplaintList, {
    params,
  });
}

/**
 * 获取客户投诉详细信息
 * @param id 投诉ID
 * @returns 客户投诉详细信息
 */
export function getCustomerComplaintDetail(id: number) {
  return requestClient.get<BaseResult<TaskCustomerComplaint>>(`${Api.customerComplaintDetail}${id}`);
}

/**
 * 新增客户投诉
 * @param data 客户投诉数据
 * @returns 新增结果
 */
export function addCustomerComplaint(data: TaskCustomerComplaint) {
  return requestClient.post<BaseResult<TaskCustomerComplaint>>(Api.customerComplaintAdd, data);
}

/**
 * 修改客户投诉
 * @param data 客户投诉数据
 * @returns 修改结果
 */
export function updateCustomerComplaint(data: TaskCustomerComplaint) {
  return requestClient.put<BaseResult<TaskCustomerComplaint>>(Api.customerComplaintUpdate, data);
}

/**
 * 删除客户投诉
 * @param ids 投诉ID列表
 * @returns 删除结果
 */
export function deleteCustomerComplaint(ids: number[]) {
  return requestClient.delete<BaseResult<boolean>>(`${Api.customerComplaintDelete}${ids.join(',')}`);
}

/**
 * 导出客户投诉列表
 * @param params 导出参数
 * @returns 导出结果
 */
export function exportCustomerComplaint(params: any) {
  return requestClient.post<BaseResult<Blob>>(Api.customerComplaintExport, params, {
    responseType: 'blob',
  });
}

/**
 * 查询经营计划列表
 * @param params 查询参数
 * @returns 经营计划列表
 */
export function getBusinessPlanList(params: any) {
  return requestClient.get<BaseResult<FormBusinessPlan[]>>(Api.businessPlanList, {
    params,
  });
}

/**
 * 查询参与记录列表
 * @param params 查询参数
 * @returns 参与记录列表
 */
export function getParticipationRecordList(params: any) {
  return requestClient.get<BaseResult<FormParticipationRecord[]>>(Api.participationRecordList, {
    params,
  });
}

