export type MinistryProgressReportLanguage = "en" | "kh";

export function normalizeMinistryProgressReportLanguage(
  language?: string,
): MinistryProgressReportLanguage {
  return language === "kh" || language === "km" ? "kh" : "en";
}

export const ministryProgressReportText = {
  en: {
    back: "Back",
    progressReports: "Progress Reports",
    invalidReportId: "Invalid progress report ID.",
    reportNotFound: "Progress report not found.",
    reportNotLoaded: "Progress report is not loaded.",
    uploadUnavailable:
      "Progress document upload is unavailable for the current report status.",

    workflow: {
      share: "Share With PSWG",
      alreadyShared: "Already Shared",
      submit: "Submit to CDC",
      resubmit: "Resubmit to CDC",
      saveDraft: "Save Draft",
      saveChange: "Save Change",
      shareTitle: "Share with PSWG",
      shareDescription: "Do you want to share this progress report with PSWG?",
      submitTitle: "Submit to CDC",
      submitDescription: "Are you sure you want to submit to CDC?",
      resubmitTitle: "Resubmit to CDC",
      resubmitDescription:
        "Are you sure you want to submit this updated report to CDC again?",
      confirm: "Confirm",
      cancel: "Cancel",
      actionError: "Unable to complete this action.",
    },

    success: {
      decisionUpdated: "RGC Decision progress updated successfully.",
      issueUpdated: "Issue progress updated successfully.",
      shared: "Progress report shared with PSWG successfully.",
      draftSaved: "Progress report draft saved successfully.",
      changesSaved: "Progress report changes saved successfully.",
      submitted: "Progress report submitted to CDC successfully.",
      resubmitted: "Progress report resubmitted to CDC successfully.",
    },

    info: {
      information: "Information",
      submittedDate: "Submitted Date",
      preparedBy: "Prepared By",
      approvalProgressReport: "Approval Progress Report",
      status: "Status",
      reviewedBy: "Reviewed By",
      latestUpdate: "Latest Update",
      requestDocument: "Request Document",
      meetingDateTime: "Meeting date & time",
      location: "Location",
      document: "Document",
    },

    description: "Description",

    print: {
      title: "Print",
      destination: "Destination",
      saveAsPdf: "Save as PDF",
      pages: "Pages",
      all: "All",
      layout: "Layout",
      portrait: "Portrait",
      landscape: "Landscape",
      cancel: "Cancel",
      preparing: "Preparing...",
      save: "Save",
      documentTitle: "Progress report print document",
      openError: "Unable to open the print document.",
    },

    issues: {
      title: "List of Issues",
      print: "Print",
      empty: "No issues found.",
      noData: "No data",
      openActions: "Open actions",
      update: "Update Issue",
      viewDetail: "View Detail",
      viewComment: "View Comment",
      statuses: {
        solved: "Solved",
        inProgress: "In Progress",
        notAddressed: "Not Addressed",
      },
      columns: {
        no: "N.O",
        pswg: "PSWG Secretariat",
        issue: "Issue",
        category: "Category of Issues",
        issueDescription: "Issue Description",
        recommendation: "Recommendation",
        rgcDecision: "RGC Decision",
        status: "Status",
        cdcInProgressStatus: "CDC In Progress Status",
        progressSolution: "Progress Solution",
        indicators: "Indicators",
        dateOfIssueSolution: "Date of Issue Solution",
        sourceOfVerification: "Source of Verification",
        linkToVerificationSource: "Link to Verification Source",
        implementationChallenges: "Implementation Challenges",
        request: "Request",
        nextStep: "Next Step",
        primaryAgency: "Gov't primary Agency",
        secondAgency: "Gov't second Agency",
        thirdAgency: "Gov't third Agency",
        fourthAgency: "Gov't fourth Agency",
        fifthAgency: "Gov't fifth Agency",
        action: "Action",
      },
    },

    decisions: {
      title: "List of RGC Decision",
      empty: "No RGC decisions found.",
      update: "Update RGC Decision",
      viewDetail: "View Detail",
      columns: {
        no: "N.O",
        ministry: "Ministry",
        rgcDecision: "RGC Decision",
        focalPerson: "Focal Person (H.E)",
        meetingDate: "Meeting Date",
        category: "Category of RGC Decision",
        status: "Status",
        cdcInProgressStatus: "CDC In Progress Status",
        progressSolution: "Progress Solution",
        indicators: "Solution Indicators",
        challenge: "Challenge",
        request: "Request",
        nextStep: "Next Step",
        dateOfIssueSolution: "Date of Issue Solution",
        sourceOfVerification: "Source of Verification",
        linkToVerificationSource: "Link to Verification Source",
        action: "Action",
      },
    },

    document: {
      title: "Progress Document",
      fallbackName: "Progress Document",
      uploading: "Uploading",
      completed: "Completed",
      clickToUpload: "Click to upload",
      dragAndDrop: "or drag and drop",
      fileHint: "pdf 10MB",
      invalidType: "Only PDF files are supported.",
      invalidSize: "PDF file must be 10 MB or smaller.",
      uploadError: "Unable to upload the progress document.",
    },

    comment: {
      viewTitle: "View Comment",
      addTitle: "Add Comment",
      editTitle: "Edit Comment",
      type: "Comment Type",
      comment: "Comment",
      selectType: "Select comment type",
      writeComment: "Write comment .........",
      suggestion: "Suggestion",
      complaint: "Complaint",
      question: "Question",
      commentedBy: "Commented by",
      cancel: "Cancel",
      save: "Save",
      saving: "Saving...",
      deleteTitle: "Delete Comment",
      deleteDescription:
        "Are you sure you want to delete Comment? This Action cannot be undone.",
      delete: "Delete",
    },

    form: {
      issueInfo: "Issue Info",
      updateIssue: "Update Issue",
      decisionInfo: "RGC Decision Info",
      updateDecision: "Update RGC Decision",
      governmentPrimaryAgency: "Government Primary Agency",
      privateSectorWorkingGroup: "Private Sector Working Group",
      ministry: "Ministry",
      status: "Status",
      issue: "Issue",
      issueCategory: "Issue Category",
      categoryOfIssues: "Category of Issues",
      focalPerson: "Focal Person (H.E)",
      issueDescription: "Issue Description",
      recommendation: "Recommendation",
      rgcDecision: "RGC Decision",
      indicators: "Indicators",
      solutionIndicators: "Solution Indicators",
      progressSolution: "Progress Solution",
      implementationChallenges: "Implementation Challenges",
      requests: "Requests",
      sourceOfVerification: "Source of Verification",
      linkToVerificationSource: "Link to Verification Source",
      nextStep: "Next Step",
      dateOfIssueSolution: "Date of Issue Solution",
      attachment: "Attachment",
      selectDate: "Select date",
      enterVerificationLink: "Enter Link to Verification Source",
      writeIssueDescription: "Write issue description.........",
      writeRecommendation: "Write recommendation.........",
      writeRgcDecision: "Write RGC Decision.........",
      writeIndicators: "Write indicators.........",
      writeProgressSolution: "Write progress solution.........",
      writeChallenges: "Write implementation challenges.........",
      writeRequests: "Write requests.........",
      writeVerificationSource: "Write source of verification.........",
      writeNextStep: "Write next step.........",
      invalidStatus: "Please select a valid status.",
      invalidIssueStatus: "Please select a valid Issue status.",
      invalidCategory: "Please select a valid Issue Category.",
      saveIssueError: "Unable to save the progress update.",
      saveDecisionError: "Unable to save the RGC Decision update.",
      addComment: "Add Comment",
      save: "Save",
      saving: "Saving...",
      loading: "Loading...",
      selectStatus: "Select status",
      selectCategory: "Select category",
    },

    // The list page: table / calendar toggle and the calendar event popup.
    list: {
      pageTitle: "All Progress Report",
      breadcrumb: "Progress Reports",
      exportButton: "Export as xlsx",
      semesterFilter: "Semester",
      yearFilter: "Year",
      statusFilter: "Status",
      allReportsButton: "All Reports",
      calendarButton: "Calendar",
      calendarTitle: "Progress Report Calendar",
      eventDialog: {
        meetingDetailsTab: "Meeting Details",
        meetingDate: "Meeting Date",
        startTime: "Start Time",
        endTime: "End Time",
        location: "Location",
        status: "Status",
        description: "Description",
        meetingRequestDocument: "Meeting Request Document",
        closeDialog: "Close",
      },
    },
  },

  kh: {
    back: "ត្រឡប់ក្រោយ",
    progressReports: "របាយការណ៍វឌ្ឍនភាព",
    invalidReportId: "លេខសម្គាល់របាយការណ៍វឌ្ឍនភាពមិនត្រឹមត្រូវ។",
    reportNotFound: "រកមិនឃើញរបាយការណ៍វឌ្ឍនភាព។",
    reportNotLoaded: "របាយការណ៍វឌ្ឍនភាពមិនទាន់បានទាញយក។",
    uploadUnavailable:
      "មិនអាចបង្ហោះឯកសារវឌ្ឍនភាពសម្រាប់ស្ថានភាពរបាយការណ៍បច្ចុប្បន្នបានទេ។",

    workflow: {
      share: "ចែករំលែកជាមួយ PSWG",
      alreadyShared: "បានចែករំលែករួចហើយ",
      submit: "ដាក់ស្នើទៅ CDC",
      resubmit: "ដាក់ស្នើទៅ CDC ម្តងទៀត",
      saveDraft: "រក្សាទុកសេចក្តីព្រាង",
      saveChange: "រក្សាទុកការផ្លាស់ប្តូរ",
      shareTitle: "ចែករំលែកជាមួយ PSWG",
      shareDescription:
        "តើអ្នកចង់ចែករំលែករបាយការណ៍វឌ្ឍនភាពនេះជាមួយ PSWG ដែរឬទេ?",
      submitTitle: "ដាក់ស្នើទៅ CDC",
      submitDescription: "តើអ្នកប្រាកដថាចង់ដាក់ស្នើរបាយការណ៍នេះទៅ CDC ដែរឬទេ?",
      resubmitTitle: "ដាក់ស្នើទៅ CDC ម្តងទៀត",
      resubmitDescription:
        "តើអ្នកប្រាកដថាចង់ដាក់ស្នើរបាយការណ៍ដែលបានកែប្រែនេះទៅ CDC ម្តងទៀតដែរឬទេ?",
      confirm: "បញ្ជាក់",
      cancel: "បោះបង់",
      actionError: "មិនអាចបំពេញសកម្មភាពនេះបានទេ។",
    },

    success: {
      decisionUpdated: "បានកែប្រែវឌ្ឍនភាពសេចក្តីសម្រេចរាជរដ្ឋាភិបាលដោយជោគជ័យ។",
      issueUpdated: "បានកែប្រែវឌ្ឍនភាពបញ្ហាដោយជោគជ័យ។",
      shared: "បានចែករំលែករបាយការណ៍វឌ្ឍនភាពជាមួយ PSWG ដោយជោគជ័យ។",
      draftSaved: "បានរក្សាទុកសេចក្តីព្រាងរបាយការណ៍វឌ្ឍនភាពដោយជោគជ័យ។",
      changesSaved: "បានរក្សាទុកការផ្លាស់ប្តូររបាយការណ៍វឌ្ឍនភាពដោយជោគជ័យ។",
      submitted: "បានដាក់ស្នើរបាយការណ៍វឌ្ឍនភាពទៅ CDC ដោយជោគជ័យ។",
      resubmitted: "បានដាក់ស្នើរបាយការណ៍វឌ្ឍនភាពទៅ CDC ម្តងទៀតដោយជោគជ័យ។",
    },

    info: {
      information: "ព័ត៌មាន",
      submittedDate: "កាលបរិច្ឆេទដាក់ស្នើ",
      preparedBy: "រៀបចំដោយ",
      approvalProgressReport: "របាយការណ៍វឌ្ឍនភាពដែលបានអនុម័ត",
      status: "ស្ថានភាព",
      reviewedBy: "ពិនិត្យដោយ",
      latestUpdate: "កែប្រែចុងក្រោយ",
      requestDocument: "ឯកសារស្នើសុំ",
      meetingDateTime: "កាលបរិច្ឆេទ និងម៉ោងប្រជុំ",
      location: "ទីតាំង",
      document: "ឯកសារ",
    },

    description: "ការពិពណ៌នា",

    print: {
      title: "បោះពុម្ព",
      destination: "គោលដៅ",
      saveAsPdf: "រក្សាទុកជា PDF",
      pages: "ទំព័រ",
      all: "ទាំងអស់",
      layout: "ប្លង់",
      portrait: "បញ្ឈរ",
      landscape: "ផ្ដេក",
      cancel: "បោះបង់",
      preparing: "កំពុងរៀបចំ...",
      save: "រក្សាទុក",
      documentTitle: "ឯកសារបោះពុម្ពរបាយការណ៍វឌ្ឍនភាព",
      openError: "មិនអាចបើកឯកសារបោះពុម្ពបានទេ។",
    },

    issues: {
      title: "បញ្ជីបញ្ហា",
      print: "បោះពុម្ព",
      empty: "រកមិនឃើញបញ្ហា។",
      noData: "គ្មានទិន្នន័យ",
      openActions: "បើកសកម្មភាព",
      update: "កែប្រែបញ្ហា",
      viewDetail: "មើលលម្អិត",
      viewComment: "មើលមតិយោបល់",
      statuses: {
        solved: "បានដោះស្រាយ",
        inProgress: "កំពុងដំណើរការ",
        notAddressed: "មិនទាន់បានដោះស្រាយ",
      },
      columns: {
        no: "ល.រ",
        pswg: "លេខាធិការដ្ឋាន PSWG",
        issue: "បញ្ហា",
        category: "ប្រភេទបញ្ហា",
        issueDescription: "ការពិពណ៌នាបញ្ហា",
        recommendation: "អនុសាសន៍",
        rgcDecision: "សេចក្តីសម្រេចរាជរដ្ឋាភិបាល",
        status: "ស្ថានភាព",
        cdcInProgressStatus: "ស្ថានភាពវឌ្ឍនភាព CDC",
        progressSolution: "វឌ្ឍនភាពដំណោះស្រាយ",
        indicators: "សូចនាករ",
        dateOfIssueSolution: "កាលបរិច្ឆេទដោះស្រាយបញ្ហា",
        sourceOfVerification: "ប្រភពផ្ទៀងផ្ទាត់",
        linkToVerificationSource: "តំណភ្ជាប់ទៅប្រភពផ្ទៀងផ្ទាត់",
        implementationChallenges: "បញ្ហាប្រឈមក្នុងការអនុវត្ត",
        request: "សំណើ",
        nextStep: "ជំហានបន្ទាប់",
        primaryAgency: "ស្ថាប័នរដ្ឋចម្បង",
        secondAgency: "ស្ថាប័នរដ្ឋទី២",
        thirdAgency: "ស្ថាប័នរដ្ឋទី៣",
        fourthAgency: "ស្ថាប័នរដ្ឋទី៤",
        fifthAgency: "ស្ថាប័នរដ្ឋទី៥",
        action: "សកម្មភាព",
      },
    },

    decisions: {
      title: "បញ្ជីសេចក្តីសម្រេចរាជរដ្ឋាភិបាល",
      empty: "រកមិនឃើញសេចក្តីសម្រេចរាជរដ្ឋាភិបាល។",
      update: "កែប្រែសេចក្តីសម្រេចរាជរដ្ឋាភិបាល",
      viewDetail: "មើលលម្អិត",
      columns: {
        no: "ល.រ",
        ministry: "ក្រសួង",
        rgcDecision: "សេចក្តីសម្រេចរាជរដ្ឋាភិបាល",
        focalPerson: "មន្ត្រីទទួលបន្ទុក (ឯកឧត្តម)",
        meetingDate: "កាលបរិច្ឆេទប្រជុំ",
        category: "ប្រភេទសេចក្តីសម្រេចរាជរដ្ឋាភិបាល",
        status: "ស្ថានភាព",
        cdcInProgressStatus: "ស្ថានភាពវឌ្ឍនភាព CDC",
        progressSolution: "វឌ្ឍនភាពដំណោះស្រាយ",
        indicators: "សូចនាករដំណោះស្រាយ",
        challenge: "បញ្ហាប្រឈម",
        request: "សំណើ",
        nextStep: "ជំហានបន្ទាប់",
        dateOfIssueSolution: "កាលបរិច្ឆេទដោះស្រាយបញ្ហា",
        sourceOfVerification: "ប្រភពផ្ទៀងផ្ទាត់",
        linkToVerificationSource: "តំណភ្ជាប់ទៅប្រភពផ្ទៀងផ្ទាត់",
        action: "សកម្មភាព",
      },
    },

    document: {
      title: "ឯកសារវឌ្ឍនភាព",
      fallbackName: "ឯកសារវឌ្ឍនភាព",
      uploading: "កំពុងបង្ហោះ",
      completed: "បានបញ្ចប់",
      clickToUpload: "ចុចដើម្បីបង្ហោះ",
      dragAndDrop: "ឬអូសនិងទម្លាក់",
      fileHint: "pdf 10MB",
      invalidType: "អនុញ្ញាតតែឯកសារ PDF ប៉ុណ្ណោះ។",
      invalidSize: "ឯកសារ PDF ត្រូវមានទំហំ 10 MB ឬតូចជាងនេះ។",
      uploadError: "មិនអាចបង្ហោះឯកសារវឌ្ឍនភាពបានទេ។",
    },

    comment: {
      viewTitle: "មើលមតិយោបល់",
      addTitle: "បន្ថែមមតិយោបល់",
      editTitle: "កែប្រែមតិយោបល់",
      type: "ប្រភេទមតិយោបល់",
      comment: "មតិយោបល់",
      selectType: "ជ្រើសរើសប្រភេទមតិយោបល់",
      writeComment: "សរសេរមតិយោបល់ .........",
      suggestion: "សំណើ",
      complaint: "បណ្តឹង",
      question: "សំណួរ",
      commentedBy: "ផ្តល់មតិដោយ",
      cancel: "បោះបង់",
      save: "រក្សាទុក",
      saving: "កំពុងរក្សាទុក...",
      deleteTitle: "លុបមតិយោបល់",
      deleteDescription:
        "តើអ្នកប្រាកដថាចង់លុបមតិយោបល់នេះដែរឬទេ? សកម្មភាពនេះមិនអាចត្រឡប់ក្រោយបានទេ។",
      delete: "លុប",
    },

    form: {
      issueInfo: "ព័ត៌មានបញ្ហា",
      updateIssue: "កែប្រែបញ្ហា",
      decisionInfo: "ព័ត៌មានសេចក្តីសម្រេចរាជរដ្ឋាភិបាល",
      updateDecision: "កែប្រែសេចក្តីសម្រេចរាជរដ្ឋាភិបាល",
      governmentPrimaryAgency: "ស្ថាប័នរដ្ឋចម្បង",
      privateSectorWorkingGroup: "ក្រុមការងារផ្នែកឯកជន",
      ministry: "ក្រសួង",
      status: "ស្ថានភាព",
      issue: "បញ្ហា",
      issueCategory: "ប្រភេទបញ្ហា",
      categoryOfIssues: "ប្រភេទបញ្ហា",
      focalPerson: "មន្ត្រីទទួលបន្ទុក (ឯកឧត្តម)",
      issueDescription: "ការពិពណ៌នាបញ្ហា",
      recommendation: "អនុសាសន៍",
      rgcDecision: "សេចក្តីសម្រេចរាជរដ្ឋាភិបាល",
      indicators: "សូចនាករ",
      solutionIndicators: "សូចនាករដំណោះស្រាយ",
      progressSolution: "វឌ្ឍនភាពដំណោះស្រាយ",
      implementationChallenges: "បញ្ហាប្រឈមក្នុងការអនុវត្ត",
      requests: "សំណើ",
      sourceOfVerification: "ប្រភពផ្ទៀងផ្ទាត់",
      linkToVerificationSource: "តំណភ្ជាប់ទៅប្រភពផ្ទៀងផ្ទាត់",
      nextStep: "ជំហានបន្ទាប់",
      dateOfIssueSolution: "កាលបរិច្ឆេទដោះស្រាយបញ្ហា",
      attachment: "ឯកសារភ្ជាប់",
      selectDate: "ជ្រើសរើសកាលបរិច្ឆេទ",
      enterVerificationLink: "បញ្ចូលតំណភ្ជាប់ទៅប្រភពផ្ទៀងផ្ទាត់",
      writeIssueDescription: "សរសេរការពិពណ៌នាបញ្ហា.........",
      writeRecommendation: "សរសេរអនុសាសន៍.........",
      writeRgcDecision: "សរសេរសេចក្តីសម្រេចរាជរដ្ឋាភិបាល.........",
      writeIndicators: "សរសេរសូចនាករ.........",
      writeProgressSolution: "សរសេរវឌ្ឍនភាពដំណោះស្រាយ.........",
      writeChallenges: "សរសេរបញ្ហាប្រឈមក្នុងការអនុវត្ត.........",
      writeRequests: "សរសេរសំណើ.........",
      writeVerificationSource: "សរសេរប្រភពផ្ទៀងផ្ទាត់.........",
      writeNextStep: "សរសេរជំហានបន្ទាប់.........",
      invalidStatus: "សូមជ្រើសរើសស្ថានភាពត្រឹមត្រូវ។",
      invalidIssueStatus: "សូមជ្រើសរើសស្ថានភាពបញ្ហាត្រឹមត្រូវ។",
      invalidCategory: "សូមជ្រើសរើសប្រភេទបញ្ហាត្រឹមត្រូវ។",
      saveIssueError: "មិនអាចរក្សាទុកបច្ចុប្បន្នភាពបញ្ហាបានទេ។",
      saveDecisionError:
        "មិនអាចរក្សាទុកបច្ចុប្បន្នភាពសេចក្តីសម្រេចរាជរដ្ឋាភិបាលបានទេ។",
      addComment: "បន្ថែមមតិយោបល់",
      save: "រក្សាទុក",
      saving: "កំពុងរក្សាទុក...",
      loading: "កំពុងទាញយក...",
      selectStatus: "ជ្រើសរើសស្ថានភាព",
      selectCategory: "ជ្រើសរើសប្រភេទបញ្ហា",
    },

    // The list page: table / calendar toggle and the calendar event popup.
    list: {
      pageTitle: "របាយការណ៍វឌ្ឍនភាពទាំងអស់",
      breadcrumb: "របាយការណ៍វឌ្ឍនភាព",
      exportButton: "នាំចេញជា xlsx",
      semesterFilter: "ឆមាស",
      yearFilter: "ឆ្នាំ",
      statusFilter: "ស្ថានភាព",
      allReportsButton: "របាយការណ៍ទាំងអស់",
      calendarButton: "ប្រតិទិន",
      calendarTitle: "ប្រតិទិនរបាយការណ៍វឌ្ឍនភាព",
      eventDialog: {
        meetingDetailsTab: "ព័ត៌មានលម្អិតកិច្ចប្រជុំ",
        meetingDate: "កាលបរិច្ឆេទប្រជុំ",
        startTime: "ម៉ោងចាប់ផ្ដើម",
        endTime: "ម៉ោងបញ្ចប់",
        location: "ទីតាំង",
        status: "ស្ថានភាព",
        description: "ការពិពណ៌នា",
        meetingRequestDocument: "ឯកសារស្នើសុំកិច្ចប្រជុំ",
        closeDialog: "បិទ",
      },
    },
  },
} as const;

export function getMinistryProgressReportText(language?: string) {
  return ministryProgressReportText[
    normalizeMinistryProgressReportLanguage(language)
  ];
}

export function translateMinistryProgressReportStatus(
  status: string,
  language?: string,
) {
  if (normalizeMinistryProgressReportLanguage(language) === "en") {
    return status;
  }

  const labels: Record<string, string> = {
    Draft: "សេចក្តីព្រាង",
    "Shared with PSWG": "បានចែករំលែកជាមួយ PSWG",
    "PSWG Reviewed": "PSWG បានពិនិត្យ",
    Submitted: "បានដាក់ស្នើ",
    "Under Review": "កំពុងពិនិត្យ",
    Completed: "បានបញ្ចប់",
    Solved: "បានដោះស្រាយ",
    "In Progress": "កំពុងដំណើរការ",
    "Not Addressed": "មិនទាន់បានដោះស្រាយ",
    "No data": "គ្មានទិន្នន័យ",
  };

  return labels[status] ?? status;
}
