import request from '@/utils/request';

/**
 * 获取整版酒单模板列表
 */
export function getWineMenuTemplates(params) {
  return request({
    url: '/barmgr/wineMenuTemplate/list',
    method: 'get',
    params
  });
}

/**
 * 获取单个模板详情
 */
export function getWineMenuTemplate(id) {
  return request({
    url: `/barmgr/wineMenuTemplate/${id}`,
    method: 'get'
  });
}

/**
 * 保存模板
 */
export function saveWineMenuTemplate(data) {
  return request({
    url: '/barmgr/menuTemplate/save',
    method: 'post',
    data
  });
}

/**
 * 更新模板
 */
export function updateWineMenuTemplate(id, data) {
  return request({
    url: `/barmgr/menuTemplate/${id}`,
    method: 'put',
    data
  });
}

/**
 * 删除模板
 */
export function deleteWineMenuTemplate(id) {
  return request({
    url: `/barmgr/wineMenuTemplate/${id}`,
    method: 'delete'
  });
}

/**
 * 复制模板
 */
export function copyWineMenuTemplate(id, newName) {
  return request({
    url: `/barmgr/wineMenuTemplate/${id}/copy`,
    method: 'post',
    data: { name: newName }
  });
}

/**
 * 更新模板状态
 */
export function updateWineMenuTemplateStatus(id, status) {
  return request({
    url: `/barmgr/menuTemplate/${id}/status`,
    method: 'put',
    data: { status }
  });
}

/**
 * 获取编辑器访问令牌
 */
export function getEditorToken(data) {
  return request({
    url: '/barmgr/editor/getToken',
    method: 'post',
    data
  });
}

/**
 * 生成整版酒单
 */
export function generateWineMenu(data) {
  return request({
    url: '/barmgr/wineMenuTemplate/generate',
    method: 'post',
    data
  });
}