import api, { unwrap } from './request';

export interface NoticeResp extends Record<string, unknown> {
  noticeId: number;
  title: string;
  content?: string;
  noticeType?: string;
  startAt?: string;
  endAt?: string;
  isActive: boolean;
  createdAt?: string;
  createdByName?: string;
}

export const noticeApi = {
  active: () => unwrap<NoticeResp[]>(api.get('/api/notices/active')),
  detail: (id: number) => unwrap<NoticeResp>(api.get(`/api/notices/${id}`)),
};
