/* global React */

const SERVICE_STAGE_DEFS = {
  tourist_visa: [
    { t: "Online Application Submission",         desc: "Application form submitted via GDRFA or ICP portal" },
    { t: "Document Upload",                        desc: "Passport copy, photo, travel insurance, itinerary uploaded" },
    { t: "Fee Payment",                            desc: "Application fee settled online or at service centre" },
    { t: "Immigration Review & Security Check",    desc: "Application reviewed by immigration authorities" },
    { t: "Approval / Rejection Decision",          desc: "Decision issued by immigration department" },
    { t: "E-Visa Issuance",                        desc: "E-visa document generated and sent to applicant" },
    { t: "Application Tracking & Completion",      desc: "Visa confirmed active; entry stamp tracked on arrival" },
  ],
  work_visa: [
    { t: "Job Offer & Contract Approval",          desc: "Employment contract attested and approved by MOHRE" },
    { t: "Work Permit Application (MOHRE)",        desc: "Work permit application submitted to Ministry of Human Resources" },
    { t: "Entry Permit Issuance",                  desc: "Entry permit issued via GDRFA for applicant to enter UAE" },
    { t: "Entry into UAE / Status Change",         desc: "Applicant enters UAE or status changed inside country" },
    { t: "Biometric Registration",                 desc: "Fingerprints and biometrics registered at GDRFA/ICP centre" },
    { t: "Medical Fitness Test",                   desc: "Medical test completed at approved government centre" },
    { t: "Labour Contract Upload",                 desc: "Final labour contract uploaded to MOHRE smart system" },
    { t: "Residence Visa Application",             desc: "Residence visa stamp application submitted to GDRFA" },
    { t: "Emirates ID & Visa Issuance",            desc: "Emirates ID and residence visa issued and delivered" },
  ],
  immigration: [
    { t: "Initial Assessment & Document Review",   desc: "Current status assessed; required documents identified" },
    { t: "Labour Card / Work Permit Filing",       desc: "Application filed with Ministry of Human Resources & Emiratisation" },
    { t: "Government Authority Submission",        desc: "Documents submitted to relevant government authority" },
    { t: "Review & Processing",                    desc: "Application reviewed by authority; queries addressed" },
    { t: "Approval & Permit Issuance",             desc: "Approval granted and permit/card issued" },
    { t: "Emirates ID Registration",               desc: "Emirates ID application submitted and tracked" },
    { t: "Completion & Handover",                  desc: "All documents collected and handed over to client" },
  ],
  pro: [
    { t: "Document Collection & Verification",     desc: "All required original documents collected and verified" },
    { t: "Attestation / Notarisation",             desc: "Documents attested by notary or relevant authority" },
    { t: "Government Submission",                  desc: "Submitted to the relevant government department" },
    { t: "Authority Processing",                   desc: "Government authority reviews and processes the submission" },
    { t: "Approval & Collection",                  desc: "Approval received; documents collected from authority" },
    { t: "Delivery to Client",                     desc: "Processed documents delivered or made available for collection" },
  ],
  trade_license: [
    { t: "Business Activity Selection",            desc: "Business activities confirmed; DED or free zone authority selected" },
    { t: "Initial Approval",                       desc: "Trade name reserved and initial approval obtained" },
    { t: "Document Preparation & Submission",      desc: "MOA, lease agreement and supporting docs submitted" },
    { t: "License Fee Payment",                    desc: "License and government fees settled" },
    { t: "Trade License Issuance",                 desc: "Trade license issued by DED or free zone authority" },
    { t: "Post-License Setup",                     desc: "Signboard, E-channel, bank account referral completed" },
  ],
  dept_approvals: [
    { t: "Requirement Assessment",                 desc: "Specific approval requirements identified per department" },
    { t: "Application Preparation",               desc: "Application forms and supporting documents prepared" },
    { t: "Department Submission",                  desc: "Application submitted to DM, MOH, KHDA, RTA or DCD" },
    { t: "Authority Review & Inspection",          desc: "Site inspection or document review conducted" },
    { t: "Approval Issuance",                      desc: "Approval certificate or NOC issued by authority" },
    { t: "Completion & Delivery",                  desc: "Approval documents delivered to client" },
  ],
  business_setup: [
    { t: "Business Structure Selection",           desc: "Mainland, free zone or offshore jurisdiction confirmed" },
    { t: "Name Reservation",                       desc: "Company name approved and reserved with authority" },
    { t: "Initial Approval",                       desc: "Initial approval obtained from DED or free zone" },
    { t: "Document Preparation (MOA / AoA)",       desc: "Memorandum and Articles of Association drafted and notarised" },
    { t: "License Application & Fee Payment",      desc: "License application submitted and all fees settled" },
    { t: "Company Registration",                   desc: "Trade license and certificate of incorporation issued" },
    { t: "Post-Setup Services",                    desc: "Bank account, visa quota, E-channel and signboard arranged" },
  ],
  economic: [
    { t: "Activity Assessment",                    desc: "Applicable DED activities and license type confirmed" },
    { t: "Application Preparation",               desc: "Application forms and required documents prepared" },
    { t: "DED Submission",                         desc: "Application submitted to Dubai Department of Economy & Tourism" },
    { t: "Review & Processing",                    desc: "DED reviews application; any queries are addressed" },
    { t: "Fee Payment",                            desc: "Government and service fees settled" },
    { t: "License / Certificate Issuance",         desc: "License or certificate issued and shared with client" },
  ],
  attestation: [
    { t: "Document Submission & Verification",     desc: "Original documents received and verified for authenticity" },
    { t: "Notarisation",                           desc: "Documents notarised by certified notary public" },
    { t: "MOFA Attestation",                       desc: "Ministry of Foreign Affairs stamp obtained" },
    { t: "Embassy / Consulate Legalisation",       desc: "Documents legalised at relevant embassy or consulate" },
    { t: "Ministry Attestation (MOE / MOH)",       desc: "Attestation from Ministry of Education or Health where required" },
    { t: "Final Delivery",                         desc: "Fully attested documents collected and delivered to client" },
  ],
};

function getServiceStages(serviceTitle) {
  const t = (serviceTitle || "").toLowerCase();
  if (t.includes("tourist") || t.includes("visit visa"))                          return SERVICE_STAGE_DEFS.tourist_visa;
  if (t.includes("trade license") || t.includes("trade licence"))                 return SERVICE_STAGE_DEFS.trade_license;
  if (t.includes("attestation") || t.includes("certificate attestation"))         return SERVICE_STAGE_DEFS.attestation;
  if (t.includes("work permit") || t.includes("immigration") || t.includes("labour card")) return SERVICE_STAGE_DEFS.immigration;
  if (t.includes("business setup"))                                                return SERVICE_STAGE_DEFS.business_setup;
  if (t.includes("economic") || t.includes("ded"))                                return SERVICE_STAGE_DEFS.economic;
  if (t.includes("department approval") || t.includes("dept approval") || t.includes("dubai department")) return SERVICE_STAGE_DEFS.dept_approvals;
  if (t.includes("pro service"))                                                   return SERVICE_STAGE_DEFS.pro;
  if (t.includes("visa"))                                                          return SERVICE_STAGE_DEFS.work_visa;
  return SERVICE_STAGE_DEFS.work_visa;
}

Object.assign(window, { SERVICE_STAGE_DEFS, getServiceStages });
