// USSD Menu Tree for *150*00# Airtel Jobs simulator

export interface USSDScreen {
  id: string;
  title: string;
  body: string[];
  options?: { key: string; label: string; next: string }[];
  input?: { placeholder: string; next: string; field: string };
  isEnd?: boolean;
}

export const ussdScreens: Record<string, USSDScreen> = {
  // ─── WELCOME ───
  welcome: {
    id: "welcome",
    title: "*150*00#",
    body: ["Airtel Jobs - Daraja", "━━━━━━━━━━━━━━━━━━"],
    options: [
      { key: "1", label: "Natafuta Kazi", next: "seeker_name" },
      { key: "2", label: "Natafuta Wafanyakazi", next: "emp_company" },
      { key: "3", label: "Lugha/Language", next: "language" },
    ],
  },

  // ─── LANGUAGE ───
  language: {
    id: "language",
    title: "Lugha / Language",
    body: ["Chagua lugha:", "Select language:"],
    options: [
      { key: "1", label: "Kiswahili", next: "lang_sw" },
      { key: "2", label: "English", next: "lang_en" },
    ],
  },
  lang_sw: {
    id: "lang_sw",
    title: "Lugha",
    body: ["Kiswahili imechaguliwa.", "", "Bonyeza OK kurudi."],
    options: [{ key: "1", label: "OK", next: "welcome" }],
  },
  lang_en: {
    id: "lang_en",
    title: "Language",
    body: ["English selected.", "", "Press OK to go back."],
    options: [{ key: "1", label: "OK", next: "welcome" }],
  },

  // ─── SEEKER FLOW ───
  seeker_name: {
    id: "seeker_name",
    title: "Sajili - Hatua 1/5",
    body: ["Karibu! Jisajili kupata kazi.", "", "Jina lako kamili:"],
    input: { placeholder: "Mfano: Juma Mohamed", next: "seeker_category", field: "name" },
  },
  seeker_category: {
    id: "seeker_category",
    title: "Sajili - Hatua 2/5",
    body: ["Chagua aina ya kazi:"],
    options: [
      { key: "1", label: "Driver", next: "seeker_location" },
      { key: "2", label: "Security", next: "seeker_location" },
      { key: "3", label: "Domestic Worker", next: "seeker_location" },
      { key: "4", label: "Cook", next: "seeker_location" },
      { key: "5", label: "Construction", next: "seeker_location" },
      { key: "6", label: "Mechanic", next: "seeker_location" },
      { key: "7", label: "Zaidi...", next: "seeker_category2" },
    ],
  },
  seeker_category2: {
    id: "seeker_category2",
    title: "Sajili - Hatua 2/5",
    body: ["Aina zaidi ya kazi:"],
    options: [
      { key: "1", label: "Electrician", next: "seeker_location" },
      { key: "2", label: "Plumber", next: "seeker_location" },
      { key: "3", label: "Tailor", next: "seeker_location" },
      { key: "4", label: "Salesperson", next: "seeker_location" },
      { key: "5", label: "Farm Worker", next: "seeker_location" },
      { key: "0", label: "Rudi", next: "seeker_category" },
    ],
  },
  seeker_location: {
    id: "seeker_location",
    title: "Sajili - Hatua 3/5",
    body: ["Chagua eneo lako:"],
    options: [
      { key: "1", label: "Dar es Salaam", next: "seeker_worktype" },
      { key: "2", label: "Mwanza", next: "seeker_worktype" },
      { key: "3", label: "Arusha", next: "seeker_worktype" },
      { key: "4", label: "Dodoma", next: "seeker_worktype" },
      { key: "5", label: "Tanga", next: "seeker_worktype" },
      { key: "6", label: "Zaidi...", next: "seeker_location2" },
    ],
  },
  seeker_location2: {
    id: "seeker_location2",
    title: "Sajili - Hatua 3/5",
    body: ["Maeneo zaidi:"],
    options: [
      { key: "1", label: "Morogoro", next: "seeker_worktype" },
      { key: "2", label: "Mbeya", next: "seeker_worktype" },
      { key: "3", label: "Zanzibar", next: "seeker_worktype" },
      { key: "4", label: "Iringa", next: "seeker_worktype" },
      { key: "5", label: "Tabora", next: "seeker_worktype" },
      { key: "0", label: "Rudi", next: "seeker_location" },
    ],
  },
  seeker_worktype: {
    id: "seeker_worktype",
    title: "Sajili - Hatua 4/5",
    body: ["Aina ya ajira:"],
    options: [
      { key: "1", label: "Full-time", next: "seeker_confirm" },
      { key: "2", label: "Part-time", next: "seeker_confirm" },
      { key: "3", label: "Gig / Vibarua", next: "seeker_confirm" },
    ],
  },
  seeker_confirm: {
    id: "seeker_confirm",
    title: "Sajili - Hatua 5/5",
    body: [
      "Thibitisha taarifa zako:",
      "━━━━━━━━━━━━━━━━━━",
      "Jina: {name}",
      "Kazi: {category}",
      "Eneo: {location}",
      "Aina: {worktype}",
      "━━━━━━━━━━━━━━━━━━",
      "Ada: TZS 2,000",
    ],
    options: [
      { key: "1", label: "Lipa na Airtel Money", next: "seeker_success" },
      { key: "0", label: "Ghairi", next: "welcome" },
    ],
  },
  seeker_success: {
    id: "seeker_success",
    title: "Umefanikiwa!",
    body: [
      "✓ Umesajiliwa!",
      "",
      "Nambari yako: DRJ-2847",
      "",
      "Utapata kazi zinazofaa",
      "kwako kupitia SMS.",
      "",
      "Asante kwa kutumia",
      "Airtel Jobs!",
    ],
    isEnd: true,
    options: [{ key: "1", label: "Mwanzo", next: "welcome" }],
  },

  // ─── EMPLOYER FLOW ───
  emp_company: {
    id: "emp_company",
    title: "Ajiri - Hatua 1/5",
    body: ["Karibu Mwajiri!", "", "Jina la kampuni:"],
    input: { placeholder: "Mfano: Bakhresa Group", next: "emp_jobtitle", field: "company" },
  },
  emp_jobtitle: {
    id: "emp_jobtitle",
    title: "Ajiri - Hatua 2/5",
    body: ["Kazi unayotaka kutangaza:", ""],
    input: { placeholder: "Mfano: Driver", next: "emp_location", field: "jobtitle" },
  },
  emp_location: {
    id: "emp_location",
    title: "Ajiri - Hatua 3/5",
    body: ["Eneo la kazi:"],
    options: [
      { key: "1", label: "Dar es Salaam", next: "emp_pay" },
      { key: "2", label: "Mwanza", next: "emp_pay" },
      { key: "3", label: "Arusha", next: "emp_pay" },
      { key: "4", label: "Dodoma", next: "emp_pay" },
      { key: "5", label: "Tanga", next: "emp_pay" },
      { key: "6", label: "Zaidi...", next: "emp_location2" },
    ],
  },
  emp_location2: {
    id: "emp_location2",
    title: "Ajiri - Hatua 3/5",
    body: ["Maeneo zaidi:"],
    options: [
      { key: "1", label: "Morogoro", next: "emp_pay" },
      { key: "2", label: "Mbeya", next: "emp_pay" },
      { key: "3", label: "Zanzibar", next: "emp_pay" },
      { key: "4", label: "Iringa", next: "emp_pay" },
      { key: "0", label: "Rudi", next: "emp_location" },
    ],
  },
  emp_pay: {
    id: "emp_pay",
    title: "Ajiri - Hatua 4/5",
    body: ["Mshahara wa siku (TZS):"],
    input: { placeholder: "Mfano: 25000", next: "emp_confirm", field: "pay" },
  },
  emp_confirm: {
    id: "emp_confirm",
    title: "Ajiri - Hatua 5/5",
    body: [
      "Thibitisha tangazo:",
      "━━━━━━━━━━━━━━━━━━",
      "Kampuni: {company}",
      "Kazi: {jobtitle}",
      "Eneo: {location}",
      "Mshahara: TZS {pay}/siku",
      "━━━━━━━━━━━━━━━━━━",
      "Ada: TZS 10,000",
    ],
    options: [
      { key: "1", label: "Lipa na Airtel Money", next: "emp_success" },
      { key: "0", label: "Ghairi", next: "welcome" },
    ],
  },
  emp_success: {
    id: "emp_success",
    title: "Umefanikiwa!",
    body: [
      "✓ Kazi imetangazwa!",
      "",
      "Nambari: JOB-5831",
      "",
      "Waombaji watakupigia",
      "simu au kupitia SMS.",
      "",
      "Asante kwa kutumia",
      "Airtel Jobs!",
    ],
    isEnd: true,
    options: [{ key: "1", label: "Mwanzo", next: "welcome" }],
  },
};
