import { APIClient, APIResponse, type AuthStoreType } from './base'

const BASE_URL = import.meta.env.VITE_API_URL + '/announcement'

export interface Announcement {
  id: number
  type: string
  message: string
}

export class AnnouncementAPIClient extends APIClient {
  constructor(authStore: AuthStoreType | null) {
    super(BASE_URL, authStore)
  }

  getAnnouncements(): APIResponse<Announcement[]> {
    return super.get('')
  }

  createAnnouncement(type: string, message: string): APIResponse<Announcement> {
    return super.post('', { type: type, message: message })
  }

  deleteAnnouncement(id: number): APIResponse<void> {
    return super.delete(`/${id}`)
  }
}
