import { request, type RequestOptions } from '@/utils/request';
const baseApi = '/api/sale_quotation/sale_quotation_group';
/** 获取报价分组列表 GET /api/sale_quotation_group */
export async function saleQuotationGroupList(params: API.SaleQuotationGroupParams, options?: RequestOptions) {
  return request<{
    items?: API.SaleQuotationGroupEntity[];
    meta?: {
      itemCount?: number;
      totalItems?: number;
      itemsPerPage?: number;
      totalPages?: number;
      currentPage?: number;
    };
  }>(baseApi, {
    method: 'GET',
    params: {
      // page has a default value: 1
      page: '1',
      // pageSize has a default value: 10
      pageSize: '10',

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

/** 新增报价分组 POST /api/sale_quotation_group */
export async function saleQuotationGroupCreate(body: API.SaleQuotationGroupDto, options?: RequestOptions) {
  return request<any>(baseApi, {
    method: 'POST',
    headers: {
      'Content-Type': 'application/json',
    },
    data: body,
    ...(options || { successMsg: '创建成功' }),
  });
}

/** 获取报价分组信息 GET /api/sale_quotation_group/${param0} */
export async function saleQuotationGroupInfo(
  // 叠加生成的Param类型 (非body参数swagger默认没有生成对象)
  params: API.SaleQuotationGroupInfoParams,
  options?: RequestOptions,
) {
  const { id: param0, ...queryParams } = params;
  return request<API.SaleQuotationGroupEntity>(`${baseApi}/${param0}`, {
    method: 'GET',
    params: { ...queryParams },
    ...(options || {}),
  });
}

/** 解除报价分组和附件关联 PUT /api/sale_quotation_group/unlink-attachments/${param0} */
export async function unlinkAttachments(
  // 叠加生成的Param类型 (非body参数swagger默认没有生成对象)
  params: API.SaleQuotationGroupUpdateParams,
  body: API.SaleQuotationGroupUpdateDto,
  options?: RequestOptions,
) {
  const { id: param0, ...queryParams } = params;
  return request<any>(`${baseApi}/unlink-attachments/${param0}`, {
    method: 'PUT',
    headers: {
      'Content-Type': 'application/json',
    },
    params: { ...queryParams },
    data: body,
    ...options,
  });
}

/** 更新报价分组 PUT /api/sale_quotation_group/${param0} */
export async function saleQuotationGroupUpdate(
  // 叠加生成的Param类型 (非body参数swagger默认没有生成对象)
  params: API.SaleQuotationGroupUpdateParams,
  body: API.SaleQuotationGroupUpdateDto,
  options?: RequestOptions,
) {
  const { id: param0, ...queryParams } = params;
  return request<any>(`${baseApi}/${param0}`, {
    method: 'PUT',
    headers: {
      'Content-Type': 'application/json',
    },
    params: { ...queryParams },
    data: body,
    ...(options || { successMsg: '更新成功' }),
  });
}

/** 删除报价分组 DELETE /api/sale_quotation_group/${param0} */
export async function saleQuotationGroupDelete(
  // 叠加生成的Param类型 (非body参数swagger默认没有生成对象)
  params: API.SaleQuotationGroupDeleteParams,
  options?: RequestOptions,
) {
  const { id: param0, ...queryParams } = params;
  return request<any>(`${baseApi}/${param0}`, {
    method: 'DELETE',
    params: { ...queryParams },
    ...(options || { successMsg: '删除成功' }),
  });
}
