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

const prefix = 'register/';

export interface RegisterOrderItem {
  id: number;
  order_no: string;
  order_number?: number;
  price: number;
  is_pay: 0 | 1;
  type: number;
  status: number;
  refund_status?: number;
  refund_time?: string;
  created_at: string;
  doctor_info?: { name: string; depart?: { name: string } };
  user_patient?: { name: string };
  store?: { name: string };
  salesperson_id?: number;
  salesperson?: { id: number; nick_name: string; avatar?: string };
  prescription?: { id: number; prescription_no: string }[];
}

export async function getRegisterListApi(data: Record<string, unknown>) {
  return requestClient.get<{ items: RegisterOrderItem[]; total: number }>(
    `${prefix}list`,
    { params: data },
  );
}

export async function refundRegisterApi(data: Record<string, unknown>) {
  return requestClient.post<any>(`${prefix}refund`, data);
}
