import type { Announcement, AnnouncementAdmin } from '../api/types';

export function hasAnnouncementWorkflowData(
  announcement: Announcement
): announcement is AnnouncementAdmin {
  return 'review_comment' in announcement;
}

export function canViewAnnouncementReviewNote({
  announcement
}: {
  announcement: Announcement;
}) {
  if (!hasAnnouncementWorkflowData(announcement)) {
    return false;
  }

  return Boolean(announcement.review_comment);
}
