import request from '@/utils/request'
import type { ApiResult, PageQuery } from '../sys/types'

// ============================ 服务区工具栏 ============================
export interface VsNavServiceToolbarVo {
  id?: number
  name?: string
  type?: string
  pic?: string
  jumpType?: number
  jumpPath?: string
  categoryId?: number
  categoryName?: string
  sortNum?: number
  status?: number
  showFlag?: number
  createTime?: string
}

export interface VsNavServiceToolbarBo {
  id?: number
  name?: string
  type?: string
  pic?: string
  jumpType?: number
  jumpPath?: string
  categoryId?: number
  sortNum?: number
  status?: number
  showFlag?: number
}

// 查询服务区工具栏列表
export function listNavServiceToolbar(query: VsNavServiceToolbarBo & PageQuery) {
  return request<ApiResult<{
    rows: VsNavServiceToolbarVo[]
    total: number
  }>>({
    url: '/system/scenic/navServiceToolbar/list',
    method: 'get',
    params: query
  })
}

// 查询服务区工具栏详细
export function getNavServiceToolbar(id: number) {
  return request<ApiResult<VsNavServiceToolbarVo>>({
    url: `/system/scenic/navServiceToolbar/${id}`,
    method: 'get'
  })
}

// 新增服务区工具栏
export function addNavServiceToolbar(data: VsNavServiceToolbarBo) {
  return request<ApiResult<void>>({
    url: '/system/scenic/navServiceToolbar',
    method: 'post',
    data: data
  })
}

// 修改服务区工具栏
export function updateNavServiceToolbar(data: VsNavServiceToolbarBo) {
  return request<ApiResult<void>>({
    url: '/system/scenic/navServiceToolbar',
    method: 'put',
    data: data
  })
}

// 删除服务区工具栏
export function delNavServiceToolbar(id: number | Array<number>) {
  return request<ApiResult<void>>({
    url: `/system/scenic/navServiceToolbar/${id}`,
    method: 'delete'
  })
}

// 导出服务区工具栏
export function exportNavServiceToolbar(query: VsNavServiceToolbarBo) {
  return request({
    url: '/system/scenic/navServiceToolbar/export',
    method: 'post',
    data: query
  })
}

// 根据分类ID查询工具栏列表
export function getToolbarByCategory(categoryId: number) {
  return request<ApiResult<VsNavServiceToolbarVo[]>>({
    url: `/system/scenic/navServiceToolbar/byCategory/${categoryId}`,
    method: 'get'
  })
}

// 获取所有分类的工具栏列表
export function getAllCategoriesToolbar() {
  return request<ApiResult<VsNavServiceToolbarVo[]>>({
    url: '/system/scenic/navServiceToolbar/allCategories',
    method: 'get'
  })
} 