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

// ============================ 底部主导航 ============================
export interface VsNavBottomMainVo {
  navId?: number
  name?: string
  pic?: string
  jumpType?: number
  jumpPath?: string
  appId?: string
  sortNum?: number
  status?: number
  title?: string
  createBy?: string
  createTime?: string
  updateBy?: string
  updateTime?: string
  remark?: string
}

export interface VsNavBottomMainBo {
  navId?: number
  navName?: string
  navIcon?: string
  pic?: string
  jumpType?: number
  navUrl?: string
  appId?: string
  navSort?: number
  navStatus?: number
  remark?: string
}

// 查询底部主导航列表
export function listNavBottomMain(query: VsNavBottomMainBo & PageQuery) {
  return request<ApiResult<{
    rows: VsNavBottomMainVo[]
    total: number
  }>>({
    url: '/system/scenic/navBottomMain/list',
    method: 'get',
    params: query
  })
}

// 查询底部主导航详细
export function getNavBottomMain(navId: number) {
  return request<ApiResult<VsNavBottomMainVo>>({
    url: `/system/scenic/navBottomMain/${navId}`,
    method: 'get'
  })
}

// 新增底部主导航
export function addNavBottomMain(data: VsNavBottomMainBo) {
  return request<ApiResult<void>>({
    url: '/system/scenic/navBottomMain',
    method: 'post',
    data: data
  })
}

// 修改底部主导航
export function updateNavBottomMain(data: VsNavBottomMainBo) {
  return request<ApiResult<void>>({
    url: '/system/scenic/navBottomMain',
    method: 'put',
    data: data
  })
}

// 删除底部主导航
export function delNavBottomMain(navId: number | Array<number>) {
  return request<ApiResult<void>>({
    url: `/system/scenic/navBottomMain/${navId}`,
    method: 'delete'
  })
}

// 导出底部主导航
export function exportNavBottomMain(query: VsNavBottomMainBo) {
  return request({
    url: '/system/scenic/navBottomMain/export',
    method: 'post',
    data: query
  })
}

// 金刚区（type=4）固定类型数据
export function listKingKongNav() {
  return request<ApiResult<VsNavBottomMainVo[]>>({
    url: '/system/scenic/navBottomMain/byType/4',
    method: 'get'
  })
}

// 轮播图（type=3）固定类型数据
export function listBannerNav() {
  return request<ApiResult<VsNavBottomMainVo[]>>({
    url: '/system/scenic/navBottomMain/byType/3',
    method: 'get'
  })
}

// 全屏广告（type=2）固定类型数据
export function listFullscreenNav() {
  return request<ApiResult<VsNavBottomMainVo[]>>({
    url: '/system/scenic/navBottomMain/byType/2',
    method: 'get'
  })
}

// 弹窗广告（type=1）固定类型数据
export function listPopupNav() {
  return request<ApiResult<VsNavBottomMainVo[]>>({
    url: '/system/scenic/navBottomMain/byType/1',
    method: 'get'
  })
}

// 服务区（type=5）固定类型数据
export function listServiceAreaNav() {
  return request<ApiResult<VsNavBottomMainVo[]>>({
    url: '/system/scenic/navBottomMain/byType/5',
    method: 'get'
  })
}

// ============================ 底部图标导航 ============================
export interface VsNavBottomIconVo {
  iconId?: number
  name?: string
  pic?: string
  iconSelected?: string
  iconUnselected?: string
  textUnselected?: string
  textUnselectedColor?: string
  textSelectedColor?: string
  jumpType?: number
  jumpPath?: string
  appId?: string
  sortNum?: number
  status?: number
  title?: string
  isSelected?: boolean
  createBy?: string
  createTime?: string
  updateBy?: string
  updateTime?: string
  remark?: string
}

export interface VsNavBottomIconBo {
  iconId?: number
  name?: string
  pic?: string
  iconSelected?: string
  iconUnselected?: string
  textUnselected?: string
  textUnselectedColor?: string
  textSelectedColor?: string
  jumpType?: number
  jumpPath?: string
  appId?: string
  sortNum?: number
  status?: number
  remark?: string
}

// 查询底部图标导航列表
export function listNavBottomIcon(query: VsNavBottomIconBo & PageQuery) {
  return request<ApiResult<{
    rows: VsNavBottomIconVo[]
    total: number
  }>>({
    url: '/system/scenic/navBottomIcon/list',
    method: 'get',
    params: query
  })
}

// 查询底部图标导航详细
export function getNavBottomIcon(iconId: number) {
  return request<ApiResult<VsNavBottomIconVo>>({
    url: `/system/scenic/navBottomIcon/${iconId}`,
    method: 'get'
  })
}

// 新增底部图标导航
export function addNavBottomIcon(data: VsNavBottomIconBo) {
  return request<ApiResult<void>>({
    url: '/system/scenic/navBottomIcon',
    method: 'post',
    data: data
  })
}

// 修改底部图标导航
export function updateNavBottomIcon(data: VsNavBottomIconBo) {
  return request<ApiResult<void>>({
    url: '/system/scenic/navBottomIcon',
    method: 'put',
    data: data
  })
}

// 删除底部图标导航
export function delNavBottomIcon(iconId: number | Array<number>) {
  return request<ApiResult<void>>({
    url: `/system/scenic/navBottomIcon/${iconId}`,
    method: 'delete'
  })
}

// 导出底部图标导航
export function exportNavBottomIcon(query: VsNavBottomIconBo) {
  return request({
    url: '/system/scenic/navBottomIcon/export',
    method: 'post',
    data: query
  })
}

// 保存颜色设置
export function saveColorSettings(data: {
  selectedTextColor: string
  unselectedTextColor: string
}) {
  return request<ApiResult<void>>({
    url: '/system/scenic/navBottomIcon/colorSettings',
    method: 'post',
    data: data
  })
}

// 获取颜色设置
export function getColorSettings() {
  return request<ApiResult<{
    selectedTextColor: string
    unselectedTextColor: string
  }>>({
    url: '/system/scenic/navBottomIcon/colorSettings',
    method: 'get'
  })
}
