import request from '@/utils/request'

export interface SeatConfigVO {
  id?: number
  seatName: string
  avatar?: string
  module: string
  status: number
  waiterIds?: number[]
  createTime?: string
  updateTime?: string
}

export interface SeatConfigQuery {
  keyword?: string
  status?: number
  module?: string
  pageNum: number
  pageSize: number
}

export const getSeatList = (query: SeatConfigQuery) => {
  return request({
    url: '/main/seat/list',
    method: 'get',
    params: query
  })
}

export const getSeatDetail = (id: number) => {
  return request({
    url: `/main/seat/${id}`,
    method: 'get'
  })
}

export const addSeat = (data: SeatConfigVO) => {
  return request({
    url: '/main/seat',
    method: 'post',
    data
  })
}

export const updateSeat = (id: number, data: SeatConfigVO) => {
  return request({
    url: `/main/seat/${id}`,
    method: 'put',
    data
  })
}

export const deleteSeat = (id: number) => {
  return request({
    url: `/main/seat/${id}`,
    method: 'delete'
  })
}

export const updateSeatStatus = (id: number, status: number) => {
  return request({
    url: `/main/seat/${id}/status`,
    method: 'put',
    data: { status }
  })
}

