// 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_pay" },
      { key: "2", label: "Natafuta Wafanyakazi", next: "emp_pay_first" },
      { 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_pay: {
    id: "seeker_pay",
    title: "Lipa - Natafuta Kazi",
    body: [
      "Karibu! Jisajili kupata kazi.",
      "",
      "Ada ya usajili:",
      "━━━━━━━━━━━━━━━━━━",
      "TZS 2,000 (Airtel Money)",
      "━━━━━━━━━━━━━━━━━━",
      "",
      "Malipo yatatoka kwenye",
      "akaunti yako ya Airtel Money.",
    ],
    options: [
      { key: "1", label: "Lipa TZS 2,000", next: "seeker_pay_success" },
      { key: "0", label: "Ghairi", next: "welcome" },
    ],
  },
  seeker_pay_success: {
    id: "seeker_pay_success",
    title: "Malipo Yamefanikiwa!",
    body: [
      "✓ TZS 2,000 imelipwa.",
      "",
      "Sasa jisajili kupata kazi",
      "zinazokufaa.",
    ],
    options: [
      { key: "1", label: "Endelea Kusajili", next: "seeker_name" },
    ],
  },
  seeker_name: {
    id: "seeker_name",
    title: "Sajili - Hatua 1/4",
    body: ["Jina lako kamili:"],
    input: { placeholder: "Mfano: Juma Mohamed", next: "seeker_category", field: "name" },
  },
  seeker_category: {
    id: "seeker_category",
    title: "Sajili - Hatua 2/4",
    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/4",
    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/4",
    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/4",
    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/4",
    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: "Thibitisha",
    body: [
      "Taarifa zako:",
      "━━━━━━━━━━━━━━━━━━",
      "Jina: {name}",
      "Kazi: {category}",
      "Eneo: {location}",
      "Aina: {worktype}",
      "━━━━━━━━━━━━━━━━━━",
    ],
    options: [
      { key: "1", label: "Thibitisha", 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.",
    ],
    options: [{ key: "1", label: "Endelea", next: "seeker_home" }],
  },

  // ─── SEEKER RETURNING USER MENU ───
  seeker_home: {
    id: "seeker_home",
    title: "*150*00# - Juma",
    body: ["Karibu tena, Juma!", "━━━━━━━━━━━━━━━━━━"],
    options: [
      { key: "1", label: "Kazi Mpya (3)", next: "sk_jobs" },
      { key: "2", label: "Maombi Yangu", next: "sk_applications" },
      { key: "3", label: "Rufaa - Pata Pesa", next: "sk_referrals" },
      { key: "4", label: "Tuzo Zangu", next: "sk_rewards" },
      { key: "5", label: "Msaada", next: "sk_help" },
    ],
  },
  sk_jobs: {
    id: "sk_jobs",
    title: "Kazi Mpya",
    body: [
      "Kazi zinazokufaa:",
      "━━━━━━━━━━━━━━━━━━",
    ],
    options: [
      { key: "1", label: "Driver - Temeke TZS 25K/siku", next: "sk_job_detail" },
      { key: "2", label: "Driver - Kinondoni TZS 20K", next: "sk_job_detail" },
      { key: "3", label: "Mechanic - Ilala TZS 30K", next: "sk_job_detail" },
      { key: "0", label: "Rudi", next: "seeker_home" },
    ],
  },
  sk_job_detail: {
    id: "sk_job_detail",
    title: "Driver - Temeke",
    body: [
      "Mwajiri: Bakhresa Group",
      "Mshahara: TZS 25,000/siku",
      "Aina: Full-time",
      "Nafasi: 3",
      "Muda: siku 5 zilizobaki",
      "━━━━━━━━━━━━━━━━━━",
      "Ada ya kuomba: TZS 1,000",
    ],
    options: [
      { key: "1", label: "Omba Kazi (TZS 1,000)", next: "sk_apply_success" },
      { key: "2", label: "Tumia Bure (una 2)", next: "sk_apply_success" },
      { key: "0", label: "Rudi", next: "sk_jobs" },
    ],
  },
  sk_apply_success: {
    id: "sk_apply_success",
    title: "Umeomba!",
    body: [
      "✓ Ombi lako limetumwa.",
      "",
      "Mwajiri atakupigia simu",
      "au kukutumia SMS.",
      "",
      "Bahati njema!",
    ],
    options: [{ key: "1", label: "Mwanzo", next: "seeker_home" }],
  },
  sk_applications: {
    id: "sk_applications",
    title: "Maombi Yangu",
    body: [
      "Hali ya maombi yako:",
      "━━━━━━━━━━━━━━━━━━",
    ],
    options: [
      { key: "1", label: "Driver Temeke - Inasubiri", next: "sk_app_detail" },
      { key: "2", label: "Security Ilala - Mahojiano!", next: "sk_app_detail" },
      { key: "3", label: "Cook Mwanza - Imekataliwa", next: "sk_app_detail" },
      { key: "0", label: "Rudi", next: "seeker_home" },
    ],
  },
  sk_app_detail: {
    id: "sk_app_detail",
    title: "Hali ya Ombi",
    body: [
      "Driver - Temeke",
      "Mwajiri: Bakhresa Group",
      "━━━━━━━━━━━━━━━━━━",
      "Hali: Inasubiri jibu",
      "Ulituma: Jana",
      "",
      "Utapata SMS wakati hali",
      "itabadilika.",
    ],
    options: [{ key: "1", label: "Rudi", next: "sk_applications" }],
  },
  sk_referrals: {
    id: "sk_referrals",
    title: "Rufaa - Pata Pesa",
    body: [
      "Msimbo wako: JUMA2847",
      "━━━━━━━━━━━━━━━━━━",
      "Marafiki waliosajiliwa: 3",
      "Pesa uliyopata: TZS 8,500",
      "Nafasi yako: #12",
      "━━━━━━━━━━━━━━━━━━",
      "",
      "Shiriki msimbo wako",
      "kupata TZS 500 kwa kila",
      "rafiki anayesajili!",
    ],
    options: [
      { key: "1", label: "Tuma kwa SMS", next: "sk_ref_sent" },
      { key: "0", label: "Rudi", next: "seeker_home" },
    ],
  },
  sk_ref_sent: {
    id: "sk_ref_sent",
    title: "SMS Imetumwa",
    body: [
      "✓ Msimbo wako JUMA2847",
      "umetumwa kwa marafiki",
      "wako watano wa hivi",
      "karibuni.",
    ],
    options: [{ key: "1", label: "Rudi", next: "seeker_home" }],
  },
  sk_rewards: {
    id: "sk_rewards",
    title: "Tuzo Zangu",
    body: [
      "Juma Mohamed - Driver",
      "━━━━━━━━━━━━━━━━━━",
      "Maombi bure: 2",
      "Pesa iliyopatikana: TZS 8,500",
      "Kiwango: Mchezaji Mpya",
      "━━━━━━━━━━━━━━━━━━",
      "Hatua inayofuata:",
      "Omba kazi 2 zaidi kupata",
      "kiwango cha SHUJAA!",
      "(Maombi 3 bure + TZS 5K)",
    ],
    options: [
      { key: "1", label: "Washindi wa Wiki", next: "sk_winners" },
      { key: "0", label: "Rudi", next: "seeker_home" },
    ],
  },
  sk_winners: {
    id: "sk_winners",
    title: "Washindi wa Wiki",
    body: [
      "1. Amina J. - 12 maombi",
      "   Tuzo: TZS 50,000",
      "2. Hassan M. - 10 maombi",
      "   Tuzo: TZS 30,000",
      "3. Grace K. - 8 maombi",
      "   Tuzo: TZS 20,000",
      "━━━━━━━━━━━━━━━━━━",
      "Wewe: #12 (5 maombi)",
    ],
    options: [{ key: "1", label: "Rudi", next: "seeker_home" }],
  },
  sk_help: {
    id: "sk_help",
    title: "Msaada",
    body: [
      "Unahitaji msaada?",
      "",
      "Piga: 100 (Bure)",
      "SMS: MSAADA kwa 15055",
      "",
      "Masaa: 7am - 10pm",
    ],
    options: [{ key: "1", label: "Rudi", next: "seeker_home" }],
  },

  // ─── EMPLOYER FLOW ───
  emp_pay_first: {
    id: "emp_pay_first",
    title: "Lipa - Tangaza Kazi",
    body: [
      "Karibu Mwajiri!",
      "",
      "Ada ya kutangaza kazi:",
      "━━━━━━━━━━━━━━━━━━",
      "TZS 10,000 (Airtel Money)",
      "━━━━━━━━━━━━━━━━━━",
      "",
      "Malipo yatatoka kwenye",
      "akaunti yako ya Airtel Money.",
    ],
    options: [
      { key: "1", label: "Lipa TZS 10,000", next: "emp_pay_success" },
      { key: "0", label: "Ghairi", next: "welcome" },
    ],
  },
  emp_pay_success: {
    id: "emp_pay_success",
    title: "Malipo Yamefanikiwa!",
    body: [
      "✓ TZS 10,000 imelipwa.",
      "",
      "Sasa tangaza kazi yako.",
    ],
    options: [
      { key: "1", label: "Endelea", next: "emp_company" },
    ],
  },
  emp_company: {
    id: "emp_company",
    title: "Ajiri - Hatua 1/7",
    body: ["Jina la kampuni/mtu:"],
    input: { placeholder: "Mfano: Bakhresa Group", next: "emp_type", field: "company" },
  },
  emp_type: {
    id: "emp_type",
    title: "Ajiri - Hatua 2/7",
    body: ["Aina ya mwajiri:"],
    options: [
      { key: "1", label: "Company", next: "emp_industry" },
      { key: "2", label: "Individual", next: "emp_industry" },
      { key: "3", label: "Household", next: "emp_industry" },
    ],
  },
  emp_industry: {
    id: "emp_industry",
    title: "Ajiri - Hatua 3/7",
    body: ["Sekta ya biashara:"],
    options: [
      { key: "1", label: "Transport", next: "emp_size" },
      { key: "2", label: "Security", next: "emp_size" },
      { key: "3", label: "Domestic", next: "emp_size" },
      { key: "4", label: "Construction", next: "emp_size" },
      { key: "5", label: "Hospitality", next: "emp_size" },
      { key: "6", label: "Agriculture", next: "emp_size" },
      { key: "7", label: "Retail", next: "emp_size" },
      { key: "8", label: "Manufacturing", next: "emp_size" },
    ],
  },
  emp_size: {
    id: "emp_size",
    title: "Ajiri - Hatua 4/7",
    body: ["Ukubwa wa biashara:"],
    options: [
      { key: "1", label: "Small (1-10)", next: "emp_jobtitle" },
      { key: "2", label: "Medium (11-50)", next: "emp_jobtitle" },
      { key: "3", label: "Large (50+)", next: "emp_jobtitle" },
    ],
  },
  emp_jobtitle: {
    id: "emp_jobtitle",
    title: "Ajiri - Hatua 5/7",
    body: ["Kazi unayotaka kutangaza:", ""],
    input: { placeholder: "Mfano: Driver", next: "emp_location", field: "jobtitle" },
  },
  emp_location: {
    id: "emp_location",
    title: "Ajiri - Hatua 6/7",
    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 6/7",
    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 7/7",
    body: ["Mshahara wa siku (TZS):"],
    input: { placeholder: "Mfano: 25000", next: "emp_confirm", field: "pay" },
  },
  emp_confirm: {
    id: "emp_confirm",
    title: "Thibitisha",
    body: [
      "Tangazo lako:",
      "━━━━━━━━━━━━━━━━━━",
      "Kampuni: {company}",
      "Aina: {emptype} - {industry}",
      "Ukubwa: {empsize}",
      "Kazi: {jobtitle}",
      "Eneo: {location}",
      "Mshahara: TZS {pay}/siku",
      "━━━━━━━━━━━━━━━━━━",
    ],
    options: [
      { key: "1", label: "Thibitisha", 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.",
    ],
    options: [{ key: "1", label: "Endelea", next: "emp_home" }],
  },

  // ─── EMPLOYER RETURNING USER MENU ───
  emp_home: {
    id: "emp_home",
    title: "*150*00# - Bakhresa",
    body: ["Karibu tena!", "━━━━━━━━━━━━━━━━━━"],
    options: [
      { key: "1", label: "Tangaza Kazi Mpya", next: "emp_pay_first" },
      { key: "2", label: "Waombaji (8 wapya)", next: "emp_applicants" },
      { key: "3", label: "Kazi Zangu (3)", next: "emp_myjobs" },
      { key: "4", label: "Rufaa - Pata Pesa", next: "emp_referrals" },
      { key: "5", label: "Tuzo Zangu", next: "emp_rewards" },
    ],
  },
  emp_applicants: {
    id: "emp_applicants",
    title: "Waombaji Wapya",
    body: [
      "Driver - Temeke (5 waombaji):",
      "━━━━━━━━━━━━━━━━━━",
    ],
    options: [
      { key: "1", label: "Juma M. - Temeke [Picha]", next: "emp_applicant_detail" },
      { key: "2", label: "Amina K. - Kariakoo", next: "emp_applicant_detail" },
      { key: "3", label: "Hassan R. - Ilala [Vyeti]", next: "emp_applicant_detail" },
      { key: "4", label: "Zaidi...", next: "emp_applicants" },
      { key: "0", label: "Rudi", next: "emp_home" },
    ],
  },
  emp_applicant_detail: {
    id: "emp_applicant_detail",
    title: "Mwombaji",
    body: [
      "Juma Mohamed",
      "Simu: 0765 432 100",
      "Eneo: Temeke",
      "Aina: Full-time",
      "━━━━━━━━━━━━━━━━━━",
      "[Picha] [Vyeti: Hakuna]",
    ],
    options: [
      { key: "1", label: "Chagua", next: "emp_selected" },
      { key: "2", label: "Piga Simu", next: "emp_applicants" },
      { key: "3", label: "Kataa", next: "emp_applicants" },
      { key: "0", label: "Rudi", next: "emp_applicants" },
    ],
  },
  emp_selected: {
    id: "emp_selected",
    title: "Umemchagua!",
    body: [
      "✓ Juma Mohamed amechaguliwa.",
      "",
      "SMS imetumwa kwake.",
      "Piga simu kumhakikishia.",
    ],
    options: [{ key: "1", label: "Rudi", next: "emp_applicants" }],
  },
  emp_myjobs: {
    id: "emp_myjobs",
    title: "Kazi Zangu",
    body: ["Kazi zako zilizo hai:"],
    options: [
      { key: "1", label: "Driver - Temeke (5 apps)", next: "emp_applicants" },
      { key: "2", label: "Security - Ilala (2 apps)", next: "emp_applicants" },
      { key: "3", label: "Cook - Mwanza (1 app)", next: "emp_applicants" },
      { key: "0", label: "Rudi", next: "emp_home" },
    ],
  },
  emp_referrals: {
    id: "emp_referrals",
    title: "Rufaa",
    body: [
      "Msimbo: BAKH-EMP",
      "━━━━━━━━━━━━━━━━━━",
      "Waajiri waliosajiliwa: 2",
      "Pesa: TZS 20,000",
      "━━━━━━━━━━━━━━━━━━",
      "",
      "Pata TZS 2,000 kwa kila",
      "mwajiri anayesajili!",
    ],
    options: [
      { key: "1", label: "Tuma kwa SMS", next: "emp_ref_sent" },
      { key: "0", label: "Rudi", next: "emp_home" },
    ],
  },
  emp_ref_sent: {
    id: "emp_ref_sent",
    title: "SMS Imetumwa",
    body: [
      "✓ Msimbo wako BAKH-EMP",
      "umetumwa kwa wenzako.",
    ],
    options: [{ key: "1", label: "Rudi", next: "emp_home" }],
  },
  emp_rewards: {
    id: "emp_rewards",
    title: "Tuzo Zangu",
    body: [
      "Bakhresa Group",
      "━━━━━━━━━━━━━━━━━━",
      "Kazi zilizotangazwa: 8",
      "Watu waliajiriwa: 5",
      "Punguzo lako: 15%",
      "Pesa iliyookolewa: TZS 12K",
      "━━━━━━━━━━━━━━━━━━",
      "Kiwango: Mwajiri Shujaa",
      "Tangaza 2 zaidi kupata 20%!",
    ],
    options: [
      { key: "1", label: "Washindi", next: "emp_winners" },
      { key: "0", label: "Rudi", next: "emp_home" },
    ],
  },
  emp_winners: {
    id: "emp_winners",
    title: "Washindi wa Wiki",
    body: [
      "1. ABC Corp - 15 kazi",
      "   Tuzo: TZS 100,000",
      "2. XYZ Ltd - 12 kazi",
      "   Tuzo: TZS 70,000",
      "3. Bakhresa - 8 kazi",
      "   Tuzo: TZS 50,000",
      "━━━━━━━━━━━━━━━━━━",
      "Wewe: #3 - Hongera!",
    ],
    options: [{ key: "1", label: "Rudi", next: "emp_home" }],
  },
};
