export const LICITATION_REVIEW_STATUSES = ["NEW", "REVIEWED", "INTERESTED", "DISCARDED"] as const;

export type LicitationReviewStatusView = (typeof LICITATION_REVIEW_STATUSES)[number];

export function parseLicitationReviewStatus(value: unknown): LicitationReviewStatusView | null {
  if (typeof value !== "string") {
    return null;
  }

  const normalized = value.trim().toUpperCase();
  return LICITATION_REVIEW_STATUSES.find((status) => status === normalized) ?? null;
}

export function getLicitationReviewStatusLabel(status: LicitationReviewStatusView) {
  if (status === "REVIEWED") {
    return "Consultada";
  }

  if (status === "INTERESTED") {
    return "Me interesa";
  }

  if (status === "DISCARDED") {
    return "Descartada";
  }

  return "Nueva";
}
