import request from "@/utils/request";
import { Account_BaseUrl } from "@/api/config";
const baseURL = Account_BaseUrl + "/admin/callTable";
const API = {
  // 获取叫号配置
  getConfig() {
    return request<any>({
      url: `${baseURL}/config`,
      method: "get",
    });
  },
  // 修改叫号配置
  editConfig(data: editConfigRequest) {
    return request<any>({
      url: `${baseURL}/config`,
      method: "put",
      data: data
    });
  },
  // 叫号桌型获取
  getTable(params: getTableRequest) {
    return request<any>({
      url: `${baseURL}`,
      method: "get",
      params
    });
  },
  addTable(data: addTableRequest) {
    return request<any>({
      url: `${baseURL}`,
      method: "post",
      data
    });
  },
  editTable(data: editTableRequest) {
    return request<any>({
      url: `${baseURL}`,
      method: "put",
      data
    });
  },
  deleteTable(data: deleteTableRequest) {
    return request<any>({
      url: `${baseURL}`,
      method: "delete",
      data
    });
  },
  // 获取叫号号码
  getTakeNumber(data: getTableNumberRequest) {
    return request<any>({
      url: `${baseURL}/takeNumber`,
      method: "post",
      data
    });
  },
  //获取叫号队列
  getTableNumberList(params: getTableNumberListRequest) {
    return request<any>({
      url: `${baseURL}/queue`,
      method: "get",
      params
    });
  },
  //执行号码
  callTableCall(data: callTableCallRequest) {
    return request<any>({
      url: `${baseURL}/call`,
      method: "post",
      data
    });
  },
  //获取叫号页面二维码
  callTableCode(params: callTableCodeRequest) {
    return request<any>({
      url: `${baseURL}/takeNumberCode`,
      method: "get",
      params
    });
  },
  //修改叫号队列状态
  updateTableState(data: updateTableStateRequest) {
    return request<any>({
      url: `${baseURL}/updateState`,
      method: "put",
      data
    });
  },
  // 获取叫号记录列表

  getCallRecord(params: getCallRecordRequest) {
    return request<any>({
      url: `${baseURL}/callRecord`,
      method: "get",
      params
    });
  },
}
export default API;

/**
 * UpdateConfigDTO
 */
export interface editConfigRequest {
  /**
   * 背景图
   */
  bgCover?: null | string;
  /**
   * 是否线上取号
   */
  isOnline?: number | null;
  /**
   * 临近几桌提醒
   */
  nearNum?: number | null;
  [property: string]: any;
}

export interface getTableRequest {
  /**
   * 叫号桌型id
   */
  callTableId?: number;
  page?: string;
  size?: string;
  /**
   * 0禁用 1使用
   */
  state?: number;
  [property: string]: any;
}

/**
 * 新增数据
 *
 * CallTableDTO
 */
export interface addTableRequest {
  /**
   * 是否顺延
   */
  isPostpone?: number | null;
  /**
   * 台桌名称
   */
  name: null | string;
  /**
   * 临近几桌提醒
   */
  nearNum: number | null;
  /**
   * 备注
   */
  note?: null | string;
  /**
   * 顺延数量
   */
  postponeNum?: number | null;
  /**
   * 前缀
   */
  prefix: null | string;
  /**
   * 起始号码
   */
  start: number | null;
  /**
   * 等待时间
   */
  waitTime: number | null;
  [property: string]: any;
}

/**
 * UpdateCallTableDTO
 */
export interface editTableRequest {
  callTableId: number | null;
  name?: null | string;
  nearNum?: number | null;
  note?: null | string;
  prefix?: null | string;
  start?: number | null;
  waitTime?: number | null;
  [property: string]: any;
}

/**
 * BaseCallTableDTO
 */
export interface deleteTableRequest {
  /**
   * 叫号桌型id
   */
  callTableId: number | null;
  [property: string]: any;
}

/**
 * TakeNumberDTO
 */
export interface getTableNumberRequest {
  /**
   * 叫号桌型id
   */
  callTableId: number | null;
  /**
   * 姓名
   */
  name?: null | string;
  /**
   * 备注
   */
  note?: null | string;
  /**
   * 手机号
   */
  phone: null | string;
  /**
   * 对应小程序用户id
   */
  userId?: number | null;
  [property: string]: any;
}
export interface Request {
  /**
   * 桌型id
   */
  callTableId?: number;
  /**
   * 状态 -1已取消 0排队中 1叫号中 2已入座 3 已过号
   */
  state?: number;
  [property: string]: any;
}
export interface getTableNumberListRequest {
  /**
   * 桌型id
   */
  callTableId?: number;
  /**
   * 状态 -1已取消 0排队中 1叫号中 2已入座 3 已过号
   */
  state?: number;
  [property: string]: any;
}
/**
 * CallQueueDTO
 */
export interface callTableCallRequest {
  callQueueId: number | null;
  [property: string]: any;
}

export interface callTableCodeRequest {
  /**
   * 叫号桌型id
   */
  callTableId: number;
  [property: string]: any;
}
/**
 * UpdateCallQueueDTO
 */
export interface updateTableStateRequest {
  callQueueId: number | null;
  state: number | null;
  [property: string]: any;
}
export interface getCallRecordRequest {
  /**
   * 桌型id
   */
  callTableId?: number;
  [property: string]: any;
}