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

const prefix = 'product/';
/**
 * 分页查询产品列表
 * @param data
 */
export async function getProductListApi(data: any) {
  return requestClient.get<any>(`${prefix}list`, { params: data });
}

/**
 * 获取产品详情
 */
export async function getProductOptionApi() {
  return requestClient.get<any>(`${prefix}option`);
}

/**
 * 获取产品详情
 * @param id
 */
export async function getProductInfoApi(id: number) {
  return requestClient.get<any>(`${prefix}detail`, { params: { id } });
}

/**
 * 新增产品
 * @param data
 */
export async function createProductApi(data: Record<string, any>) {
  return requestClient.post<any>(`${prefix}create`, data);
}

/**
 * 编辑产品
 * @param data
 */
export async function updateProductApi(data: Record<string, any>) {
  return requestClient.post<any>(`${prefix}update`, data);
}

/**
 * 删除产品
 * @param data
 */
export async function deleteProductApi(data: Record<string, any>) {
  return requestClient.post<any>(`${prefix}delete`, data);
}
