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

const prefix = 'doctor/';
/**
 * 分页查询用户列表
 * @param data
 */
export async function getDoctorList(data: any) {
  return requestClient.get<any>(`${prefix}list`, { params: data });
}
/**
 * 获取科室选项
 * @param data
 */
export async function getDepartOptionApi() {
  return requestClient.get<any>(`${prefix}depart-option`);
}

/** 诊疗科目下拉（互联网医院组包 subjects_id） */
export async function getSubjectsOptionApi() {
  return requestClient.get<any>(`${prefix}subjects-option`);
}
/**
 * 分页查询用户列表
 * @param data
 */
export async function getDoctorInfoByStoreApi(data: any) {
  return requestClient.get<any>(`${prefix}doctor-info-by-store`, { params: data });
}
/**
 * 查询我的余额
 * @param data
 */
export async function getDoctorAccountBalance(data: any = {}) {
  return requestClient.get<any>(`${prefix}my-balance`, { params: data });
}

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

/**
 * 获取医生详情
 * @param id
 */
export async function storeByDoctorIdApi(id: number) {
  return requestClient.get<any>(`${prefix}store-by-doctor-id`, {
    params: { id },
  });
}

/**
 * 新增医生
 * @param data
 */
export async function updateDoctorStoreBindApi(data: Record<string, any>) {
  return requestClient.post<any>(`${prefix}update-store-bind`, data);
}

/** doctor_id 为 su_id，与 update-store-bind 一致 */
export async function updateDoctorSubjectsBindApi(data: Record<string, any>) {
  return requestClient.post<any>(`${prefix}update-subjects-bind`, data);
}

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

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

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

/**
 * 修改密码
 * @param data
 */
export async function updatePassword(data: Record<string, any>) {
  return requestClient.post<any>(`${prefix}update-password`, data);
}

/**
 * 删除医生
 * @param id
 */
export async function openPcWindowsApi(id: number) {
  return requestClient.post<any>(`${prefix}open-pc-windows`, {
    id,
  });
}

/**
 * 审核通过医生
 * @param id
 */
export async function auditApi(id: number) {
  return requestClient.post<any>(`${prefix}audit`, {
    id,
  });
}

/**
 * 审核拒绝医生
 * @param id
 */
export async function refuseApi(id: number) {
  return requestClient.post<any>(`${prefix}refuse`, {
    id,
  });
}

/**
 * 获取我绑定的银行卡
 */
export async function getMyCard() {
  return requestClient.get<any>(`${prefix}my-card`);
}

/**
 * 编辑账户绑定银行卡
 * @param data
 */
export async function saveCard(data: Record<string, any>) {
  return requestClient.post<any>(`${prefix}save-card`, data);
}
