import { request, type RequestOptions } from '@/utils/request';



/** 获取车辆使用记录列表 GET /api/vehicle-usage */
export async function vehicleUsageList(params: API.VehicleUsageParams, options?: RequestOptions) {
  return request<{
    items?: API.VehicleUsageEntity[];
    meta?: {
      itemCount?: number;
      totalItems?: number;
      itemsPerPage?: number;
      totalPages?: number;
      currentPage?: number;
    };
  }>('/api/vehicle-usage', {
    method: 'GET',
    params: {
      // page has a default value: 1
      page: '1',
      // pageSize has a default value: 10
      pageSize: '10',

      ...params,
    },
    ...(options || {}),
  });
}

/** 新增车辆使用记录 POST /api/vehicle-usage */
export async function vehicleUsageCreate(body: API.VehicleUsageDto, options?: RequestOptions) {
  return request<any>('/api/vehicle-usage', {
    method: 'POST',
    headers: {
      'Content-Type': 'application/json',
    },
    data: body,
    ...(options || { successMsg: '创建成功' }),
  });
}

/** 获取车辆使用记录信息 GET /api/vehicle-usage/${param0} */
export async function vehicleUsageInfo(
  // 叠加生成的Param类型 (非body参数swagger默认没有生成对象)
  params: API.VehicleUsageInfoParams,
  options?: RequestOptions,
) {
  const { id: param0, ...queryParams } = params;
  return request<API.VehicleUsageEntity>(`/api/vehicle-usage/${param0}`, {
    method: 'GET',
    params: { ...queryParams },
    ...(options || {}),
  });
}

/** 解除车辆使用记录和附件关联 PUT /api/vehicle-usage/unlink-attachments/${param0} */
export async function unlinkAttachments(
  // 叠加生成的Param类型 (非body参数swagger默认没有生成对象)
  params: API.VehicleUsageUpdateParams,
  body: API.VehicleUsageUpdateDto,
  options?: RequestOptions,
) {
  const { id: param0, ...queryParams } = params;
  return request<any>(`/api/vehicle-usage/unlink-attachments/${param0}`, {
    method: 'PUT',
    headers: {
      'Content-Type': 'application/json',
    },
    params: { ...queryParams },
    data: body,
    ...options,
  });
}

/** 更新车辆使用记录 PUT /api/vehicle-usage/${param0} */
export async function vehicleUsageUpdate(
  // 叠加生成的Param类型 (非body参数swagger默认没有生成对象)
  params: API.VehicleUsageUpdateParams,
  body: API.VehicleUsageUpdateDto,
  options?: RequestOptions,
) {
  const { id: param0, ...queryParams } = params;
  return request<any>(`/api/vehicle-usage/${param0}`, {
    method: 'PUT',
    headers: {
      'Content-Type': 'application/json',
    },
    params: { ...queryParams },
    data: body,
    ...(options || { successMsg: '更新成功' }),
  });
}

/** 删除车辆使用记录 DELETE /api/vehicle-usage/${param0} */
export async function vehicleUsageDelete(
  // 叠加生成的Param类型 (非body参数swagger默认没有生成对象)
  params: API.VehicleUsageDeleteParams,
  options?: RequestOptions,
) {
  const { id: param0, ...queryParams } = params;
  return request<any>(`/api/vehicle-usage/${param0}`, {
    method: 'DELETE',
    params: { ...queryParams },
    ...(options || { successMsg: '删除成功' }),
  });
}
