import { gxFetch, ResponseDataEntity } from '.';

class Params {
  /** 消费者id，必填项 */
  customerId: string;
  /** 校区id，必填项 */
  campusId: number;
}
export class DeviceInfoResponse {
  /** 设备编码 */
  code = '';

  /** 是否当前人使用 1：是，0：否 */
  isCurrentUserUsed = undefined;

  /** 是否上线 1：是，0：否 */
  isOnline = undefined;

  /** 是否被使用 1：是，0：否 */
  isUsed = undefined;

  /** 运营商Id */
  operatorId = undefined;

  /** 运营商名称 */
  operatorName = '';

  /** 位置名称 */
  position = '';

  /** 位置id */
  positionId = '';

  /** 费率信息 */
  rates = [];

  /** 服务Id */
  serviceId = undefined;

  /** 服务名称 */
  serviceName = '';
}
export const getUsedEquipment = (params: Params) =>
  gxFetch({
    url: '/dcxy/api/gx/devices/lastUsedByCurrentUser',
    data: params,
  });
export const getUsingEquipment = (params: { customerId: string }) =>
  gxFetch({
    url: '/dcxy/api/gx/devices/inuseByCurrentUser',
    data: params,
  });
export const waterBeginning = (params: {
  deviceCode: string;
  campusId: number;
  customerId: number;
  customerName: string;
  customerPhone: string;
}) =>
  gxFetch({
    url: `/dcxy/api/gx/devices/${params.deviceCode}/beginning`,
    method: 'POST',
    data: params,
  });
export const fetchWaterEquipmentInfo = (params: {
  deviceCode: string;
  customerId: string;
  campusId: number;
}) =>
  gxFetch({
    url: `/dcxy/api/gx/devices/${params.deviceCode}`,
    data: params,
  });

enum DefualtMode {
  code = 1,
  scan = 2,
}
enum Mode {
  code = 1,
  scan = 2,
  mix = 3,
}
export type PageConfigResponse = {
  /** 校区id */
  campusId: string;

  /** 混合模式下的默认使用方式（1.条码，2扫码） */
  defualtMode: DefualtMode;

  /** 使用方式（1.条码，2扫码，3 混合） */
  mode: Mode;
};
export const fetchPageConfig = (params: { campusId: number }) =>
  gxFetch({
    url: '/dcxy/api/gx/pageConfigs',
    data: params,
  });
