import { request } from '@/api/request'

/** 获取工单模板列表 */
export const fetchTemplates = (data?: { page?: number; page_size?: number; status?: string }) => {
  return request.get('/Feedback/v1/templates', data ? { params: data } : undefined)
}

/** 创建工单模板 */
export const createTemplate = (data: any) => request.post('/Feedback/v1/templates', data)

/** 更新工单模板 */
export const updateTemplate = (id: number, data: any) => request.put(`/Feedback/v1/templates/${id}`, data)

/** 获取工单模板详情 */
export const fetchTemplateDetail = (id: number) => request.get(`/Feedback/v1/templates/${id}`)

/** 删除工单模板 */
export const deleteTemplate = (id: number) => request.delete(`/Feedback/v1/templates/${id}`)

/** 启用工单模板 */
export const activateTemplate = (id: number) => request.post(`/Feedback/v1/templates/${id}/activate`)

/** 禁用工单模板 */
export const deactivateTemplate = (id: number) => request.post(`/Feedback/v1/templates/${id}/deactivate`)

/** 按模板创建工单 */
export const createTicketByTemplate = (id: number) => request.post(`/Feedback/v1/templates/${id}/create-ticket`)
