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

const prefix = 'transfer-prescription/';

export async function getSalespersonTransferListApi(params: Record<string, any>) {
  return requestClient.get<any>(`${prefix}salesperson-list`, { params });
}

export async function getSalespersonTransferDetailApi(id: number) {
  return requestClient.get<any>(`${prefix}salesperson-detail`, { params: { id } });
}

export async function getSalespersonTransferByRegisterApi(registerId: number) {
  return requestClient.get<any>(`${prefix}get-salesperson-by-register`, {
    params: { register_id: registerId },
  });
}

/** 医生端悬浮窗：按传方 ID + 挂号 ID 准备导入（补全门店价） */
export async function prepareDoctorImportApi(id: number, registerId: number) {
  return requestClient.get<any>(`${prefix}prepare-doctor-import`, {
    params: { id, register_id: registerId },
  });
}

export async function markSalespersonTransferImportedApi(
  id: number,
  registerId: number,
) {
  return requestClient.post<any>(`${prefix}mark-salesperson-imported`, {
    id,
    register_id: registerId,
  });
}

/** 医生端：按门店获取传方列表（悬浮窗） */
export async function getTransferPrescriptionListByStoreApi(
  params: Record<string, any>,
) {
  return requestClient.get<any>(`${prefix}list-by-store`, { params });
}

/** 医生手动更新传方处理状态 */
export async function updateTransferPrescriptionHandleStatusApi(
  data: Record<string, any>,
) {
  return requestClient.post<any>(`${prefix}update-handle-status`, data);
}
