import kcRequest from "@/service/request/index.js";

// ============== 工作台 ==============
export const getWorkbench = (params) => {
  return kcRequest.request(`/hospital/workbench`, "get", params);
};

// ============== 工单 ==============
export const getHospitalOrders = (params) => {
  return kcRequest.request(`/hospital/orders`, "get", params);
};
export const getHospitalOrderDetail = (id) => {
  return kcRequest.request(`/hospital/orders/${id}`, "get");
};
export const createHospitalOrder = (formData) => {
  return kcRequest.uploadFile(`/hospital/orders`, formData);
};
export const updateHospitalOrder = (id, formData) => {
  return kcRequest.uploadFile(`/hospital/orders/${id}`, formData, true, "PUT");
};
export const cancelHospitalOrder = (id) => {
  return kcRequest.request(`/hospital/orders/${id}`, "delete");
};

// ============== 积分 ==============
export const getPoints = () => {
  return kcRequest.request(`/hospital/points`, "get");
};
export const getPointsDetails = (params) => {
  return kcRequest.request(`/hospital/points/details`, "get", params);
};
export const signIn = (data) => {
  return kcRequest.request(`/hospital/signin`, "post", data);
};
export const draw = () => {
  return kcRequest.request(`/hospital/draw`, "post");
};
export const redeem = (data) => {
  return kcRequest.request(`/hospital/redeem`, "post", data);
};
export const getRedeems = (params) => {
  return kcRequest.request(`/hospital/redeems`, "get", params);
};

// ============== 账号 ==============
// 当前登录用户修改自己的密码（401 = 旧密码错误，使用 silent 避免跳登录页）
export const changePassword = (data) => {
  return kcRequest.request(`/hospital/accounts/change-password`, "put", data, true, "json", true);
};
