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

const prefix = 'pharmacist/';
/**
 * 分页查询用户列表
 * @param data
 */
export async function getPharmacistList(data: any) {
  return requestClient.get<any>(`${prefix}list`, { params: data });
}
/**
 * 分页查询用户列表
 * @param data
 */
export async function getPharmacistTitleOptionApi() {
  return requestClient.get<any>(`${prefix}title-option`, {
    params: {
      type: 2,
    },
  });
}
/**
 * 获取医生职称
 * @param data
 */
export async function getDoctorTitleOptionApi() {
  return requestClient.get<any>(`${prefix}title-option`, {
    params: {
      type: 1,
    },
  });
}
/**
 * 分页查询用户列表
 * @param data
 */
export async function getPharmacistInfoByStoreApi(data: any) {
  return requestClient.get<any>(`${prefix}pharmacist-info-by-store`, {
    params: data,
  });
}
/**
 * 查询我的余额
 * @param data
 */
export async function getPharmacistAccountBalance(data: any = {}) {
  return requestClient.get<any>(`${prefix}my-balance`, { params: data });
}

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

/**
 * 获取药师详情 - 编辑
 * @param id
 */
export async function getPharmacistEditInfoApi(id: number) {
  return requestClient.get<any>(`${prefix}get-edit-info`, { params: { id } });
}

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

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

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

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

/**
 * 删除药师
 * @param data
 */
export async function deletePharmacist(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);
}
