import baseAxios from '../index'
import { banner_status } from '@/views/Root/Banner/const'
import { iBannerItem } from './types'
import { eBannerStatus } from '@/types/banner'
const prefix = '/banner/admin'

// 新增banner信息
export function bannerAdd(data: {
  file_name: string
  location: number
  title: string
}) {
  return baseAxios({
    url: prefix + '/add',
    method: 'POST',
    data,
  })
}

// 查询banner列表
export function bannerQuery(data: {
  banner_status: eBannerStatus
  location: number
  end_time?: number
  start_time?: number
  limit?: number
  offset?: number
}) {
  return baseAxios<{
    count: number
    items: iBannerItem[]
    total: number
  }>({
    url: prefix + '/list',
    method: 'POST',
    data,
  })
}

// 修改banner状态
export function bannerModify(data: {
  banner_status: eBannerStatus
  uuid: string
}) {
  return baseAxios({
    url: prefix + '/modify',
    method: 'POST',
    data,
  })
}
