import service from '@/utils/request/index'
import type {
  ArticleSearchParams,
  AddOrUpdateCarouselDto,
  BackendArticleListItemDto,
  BackendCarouselListItemDto,
} from './types'
import type { BackendServicePageResult } from '@/utils/request/types'
// 后台管理标签相关接口

/**
 * 获取轮播图列表  不分页 数量不多
 */
export const getCarouselList = () => {
  return service.request<BackendCarouselListItemDto[]>({
    url: '/api/cultureCarousel/listNoPage',
    method: 'POST',
    data: {},
  })
}

/**
 * 添加轮播
 */
export const addCarousel = (data: AddOrUpdateCarouselDto) => {
  return service.request({
    url: '/api/cultureCarousel/addCarousel',
    method: 'POST',
    data,
  })
}

/**
 * 更新轮播图
 */
export const editCarousel = (data: AddOrUpdateCarouselDto) => {
  return service.request({
    url: '/api/cultureCarousel/editCarousel',
    method: 'POST',
    data,
  })
}

/**
 * 根据类型获取文章列表
 */
export const getArticleList = (data: ArticleSearchParams) => {
  return service.request<BackendServicePageResult<BackendArticleListItemDto>>({
    url: `/api/cultureArticle/listByPage`,
    method: 'POST',
    data,
  })
}
