/**
 * Helper to compute status dynamically on the client or server without requiring a server action
 */
export function getAnnouncementStatus(ann: {
  status: string;
  publishDateTime: string | Date;
  expiryDateTime?: string | Date;
}): 'Scheduled' | 'Published' | 'Expired' | 'Archived' {
  if (ann.status === 'Archived') return 'Archived';
  const now = new Date();
  const pub = new Date(ann.publishDateTime);
  if (pub > now) return 'Scheduled';
  if (ann.expiryDateTime && new Date(ann.expiryDateTime) < now) return 'Expired';
  return 'Published';
}
