const enum MeetingStatus {
  NOT_IN_MEETING = "Not in meeting",
  IN_MEETING = "In meeting",
  NOT_AVAILABLE = "Not available",
}

const getStatusColor = (ms: MeetingStatus): string => {
  switch (ms) {
    case MeetingStatus.NOT_IN_MEETING: {
      return "#70ff70";
    }
    case MeetingStatus.IN_MEETING: {
      return "#ff7070";
    }
    case MeetingStatus.NOT_AVAILABLE: {
      return "#808080";
    }
  }
};

const formatTimeFromDate = (date: Date): string => {
  let hour = date.getHours();
  let ampm = "";
  const minutes =
    date.getMinutes() < 10 ? "0" + date.getMinutes() : "" + date.getMinutes();
  if (hour < 12) {
    ampm = "am";
  } else {
    hour = hour === 12 ? 12 : hour - 12;
    ampm = "pm";
  }
  return hour + ":" + minutes + ampm;
};

export { MeetingStatus, getStatusColor, formatTimeFromDate };
