/**
 * Practice-area constants for the precedent library.
 *
 * The chair confined the library to the three appeals committee
 * domains — no national-insurance corpus. The DB enforces this
 * via a CHECK constraint on case_law.practice_area.
 */

export const PRACTICE_AREAS = [
  { value: "rishuy_uvniya", label: "רישוי ובניה", short: "רישוי" },
  { value: "betterment_levy", label: "היטל השבחה", short: "השבחה" },
  { value: "compensation_197", label: "פיצויים לפי ס' 197", short: "פיצויים" },
] as const;

export const PRECEDENT_LEVELS = [
  { value: "עליון", label: "עליון" },
  { value: "מנהלי", label: "מנהלי" },
  { value: "ועדת_ערר_ארצית", label: "ועדת ערר ארצית" },
  { value: "ועדת_ערר_מחוזית", label: "ועדת ערר מחוזית" },
] as const;

export const SOURCE_TYPES = [
  { value: "court_ruling", label: "פסק דין" },
  { value: "appeals_committee", label: "החלטת ועדת ערר" },
] as const;

export function practiceAreaLabel(value: string | null | undefined): string {
  if (!value) return "—";
  const match = PRACTICE_AREAS.find((p) => p.value === value);
  return match ? match.label : value;
}

export function practiceAreaShort(value: string | null | undefined): string {
  if (!value) return "—";
  const match = PRACTICE_AREAS.find((p) => p.value === value);
  return match ? match.short : value;
}
