/** Protocol 4: age 18 to 29, qualifying education, unemployed or underemployed at enrolment (V1 rule). */
const EDUCATION = new Set(["secondary", "high_school_dropout", "tvet_1_4", "diploma", "bachelor", "above_bachelor"]);
const EMPLOYMENT = new Set(["not_working", "occasional", "underemployed"]);
export function eligibility(t: { age: number | null; education: string | null; employment: string | null }): { status: "eligible" | "not_eligible" | "unknown"; reasons: string[] } {
  const reasons: string[] = [];
  if (t.age === null || t.education === null || t.employment === null) return { status: "unknown", reasons: ["Age, education or employment status is missing."] };
  if (t.age < 18 || t.age > 29) reasons.push("Age is not between 18 and 29.");
  if (!EDUCATION.has(t.education)) reasons.push("The education level does not qualify.");
  if (!EMPLOYMENT.has(t.employment)) reasons.push("The employment status does not qualify.");
  return { status: reasons.length ? "not_eligible" : "eligible", reasons };
}
