import request from '@/utils/request'

export interface TicketVO {
  id?: string
  sessionId?: number
  userId: string
  userName: string
  content: string
  source: string
  category: string
  status: string
  handlerId?: number
  handlerReply?: string
  createTime?: string
  updateTime?: string
}

export interface TicketQuery {
  id?: string
  userId?: string
  source?: string
  category?: string
  status?: string
  pageNum: number
  pageSize: number
}

// 查询工单列表
export function listTicket(query: TicketQuery) {
  return request({
    url: '/main/ticket/list',
    method: 'get',
    params: query
  })
}

// 查询工单详情
export function getTicket(id: string) {
  return request({
    url: '/main/ticket/' + id,
    method: 'get'
  })
}

// 处理工单
export function processTicket(data: any) {
  return request({
    url: '/main/ticket/handle',
    method: 'put',
    data: data
  })
}

// 删除工单
export function delTicket(id: string) {
  return request({
    url: '/main/ticket/' + id,
    method: 'delete'
  })
}
