import { get } from '../utils/request';

/**
 * 公告相关接口
 */

/**
 * 公告信息接口
 */
export interface Announcement {
  id: number;
  title: string;
  content: string;
  type: number;
  typeLabel: string;
  typeColor: string;
  coverImage: string;
  isTop: number;
  status: number;
  statusLabel: string;
  statusColor: string;
  publishTime: string | null;
  publisherName?: string;
  readCount: number;
  createTime: string;
}

/**
 * 获取公告列表
 * @param limit 数量限制
 */
export const getAnnouncementList = (limit: number = 10): Promise<Announcement[]> => {
  return get<Announcement[]>('/announcement/list', { limit });
};

/**
 * 获取公告详情
 * @param id 公告ID
 */
export const getAnnouncementDetail = (id: number): Promise<Announcement> => {
  return get<Announcement>('/announcement/detail', { id });
};
