import { showerFetch } from './index';

type ShowerParams = {
  deviceCode: string;
  customerId: string;
  campusId: number;
};
export type DeviceInfoResponse = {
  code: string;
  isOnlyBluetooth: number;
  position: string;
};
/**
 * 通过设备码获取设备信息
 */
export const fetchShowerInfo = (params: ShowerParams) =>
  showerFetch({
    url: `/dcxy/api/shower/devices/${params.deviceCode}`,
    data: params,
  });

type UsingParams = {
  customerId: number;
};
/**
 * 通过用户查询在使用的设备信息
 */
export const fetchUsingShowerInfo = (params: UsingParams) =>
  showerFetch({
    url: '/dcxy/api/shower/devices/inuseByCurrentUser',
    data: params,
  });

type StartParams = {
  deviceCode: string;
  customerId: string;
  customerName: string;
  customerPhone: string;
};
/**
 * 开启设备使用
 */
export const startShowerEquipment = (params: StartParams) =>
  showerFetch({
    url: `/dcxy/api/shower/devices/${params.deviceCode}/beginning`,
    method: 'POST',
    data: params,
  });
