import { Guide, NewsItem, NewsQueryDTO, NewsType } from "@/types/news";
import flyio from "../flyio";
import { ApiResponse, ApiResponseList } from "@/types";

/**
 * 获取新闻列表
 * @returns 
 */
export function getNewsMainList() {
  return flyio.get('/front/news/getMainListNoToken') as Promise<ApiResponseList<Guide>>;
}

/**
 * 获取资讯列表
 * @returns 
 */
export function getNewsListNoToken(params: NewsQueryDTO) {
  return flyio.get('/front/news/listNoToken', params) as Promise<ApiResponseList<NewsItem>>;
}

/**
 * 获取资讯详情
 */
export function getNewsDetail(id: number) {
  return flyio.get(`/front/news/info`, { id }) as Promise<ApiResponse<NewsItem>>;
}

/**
 * 获取资讯类型列表
 * @returns 
 */
export function getNewsTypes() {
  return flyio.get('/front/news/typesNoToken') as Promise<ApiResponseList<NewsType>>;
}