"use client";

import { useAppLanguage } from "@/components/providers/app-language-provider";

// Every word shown on the sign-in, forgot-password, OTP and new-password
// screens. Kept in one file so the four screens stay worded the same way.
const authText = {
  en: {
    // Left side of the sign-in page
    welcome: "Welcome!",
    systemName: "G-PSF Monitoring System",
    heroDescription:
      "The Royal Government of Cambodia considers the private sector as a key partner and engine of national economic growth.",

    // Sign in
    signInTitle: "Sign in to your account",
    email: "Email",
    password: "Password",
    passwordPlaceholder: "Your password",
    showPassword: "Show password",
    hidePassword: "Hide password",
    forgotPassword: "Forgot password?",
    signIn: "SIGN IN",
    signingIn: "SIGNING IN...",
    emailRequired: "Please complete your email.",
    emailInvalid: "Please enter a valid email address.",
    passwordRequired: "Please complete your password.",
    signInFailed: "Email or password is incorrect.",
    sessionExpiredTitle: "Session Expired",
    sessionExpiredDescription:
      "Your session has timed out due to inactivity. Please sign in again to continue where you left off.",
    signInAgain: "Sign In Again",

    // Forgot password
    forgotPasswordTitle: "Forgot password?",
    backToSignIn: "back to sign in",
    back: "Back",
    emailPlaceholder: "Enter your email",
    sendEmail: "Send e-mail",
    sending: "Sending...",
    enterEmail: "Please enter your email.",
    invalidEmail: "Invalid email.",
    sendResetFailed: "Unable to send the reset code.",

    // OTP
    otpTitle: "Enter the OTP",
    otpNumber: "OTP Number",
    otpSentTo: "sent to",
    resend: "Resend",
    next: "Next",
    otpMissingEmail: "Missing email. Please start from the forgot password page.",
    otpIncomplete: "Please enter the 6-digit OTP.",
    otpResent: "A new OTP has been sent to your email.",
    otpResendFailed: "Unable to resend the OTP.",

    // New password
    newPasswordTitle: "New password",
    newPassword: "New password",
    newPasswordPlaceholder: "Enter a new password",
    confirmPassword: "Password confirmation",
    confirmPasswordPlaceholder: "Enter the password again",
    confirm: "Confirm",
    saving: "Saving...",
    newPasswordRequired: "Please enter a new password.",
    passwordTooShort: "Password must be at least 8 characters.",
    confirmPasswordRequired: "Please confirm your password.",
    passwordsDoNotMatch: "Passwords do not match.",
    resetMissingDetails:
      "Missing email or OTP. Please start from the forgot password page.",
    resetFailed: "Unable to reset your password.",
  },
  kh: {
    welcome: "សូមស្វាគមន៍!",
    systemName: "ប្រព័ន្ធតាមដាន G-PSF",
    heroDescription:
      "រាជរដ្ឋាភិបាលកម្ពុជាចាត់ទុកវិស័យឯកជនជាដៃគូសំខាន់ និងជាកម្លាំងចលករនៃកំណើនសេដ្ឋកិច្ចជាតិ។",

    signInTitle: "ចូលទៅគណនីរបស់អ្នក",
    email: "អ៊ីមែល",
    password: "ពាក្យសម្ងាត់",
    passwordPlaceholder: "ពាក្យសម្ងាត់របស់អ្នក",
    showPassword: "បង្ហាញពាក្យសម្ងាត់",
    hidePassword: "លាក់ពាក្យសម្ងាត់",
    forgotPassword: "ភ្លេចពាក្យសម្ងាត់?",
    signIn: "ចូល",
    signingIn: "កំពុងចូល...",
    emailRequired: "សូមបញ្ចូលអ៊ីមែលរបស់អ្នក។",
    emailInvalid: "សូមបញ្ចូលអាសយដ្ឋានអ៊ីមែលឱ្យបានត្រឹមត្រូវ។",
    passwordRequired: "សូមបញ្ចូលពាក្យសម្ងាត់របស់អ្នក។",
    signInFailed: "អ៊ីមែល ឬពាក្យសម្ងាត់មិនត្រឹមត្រូវ។",
    sessionExpiredTitle: "វគ្គបានផុតកំណត់",
    sessionExpiredDescription:
      "វគ្គរបស់អ្នកបានផុតកំណត់ ដោយសារមិនមានសកម្មភាព។ សូមចូលម្តងទៀត ដើម្បីបន្តការងាររបស់អ្នក។",
    signInAgain: "ចូលម្តងទៀត",

    forgotPasswordTitle: "ភ្លេចពាក្យសម្ងាត់?",
    backToSignIn: "ត្រឡប់ទៅទំព័រចូល",
    back: "ត្រឡប់ក្រោយ",
    emailPlaceholder: "បញ្ចូលអ៊ីមែលរបស់អ្នក",
    sendEmail: "ផ្ញើអ៊ីមែល",
    sending: "កំពុងផ្ញើ...",
    enterEmail: "សូមបញ្ចូលអ៊ីមែលរបស់អ្នក។",
    invalidEmail: "អ៊ីមែលមិនត្រឹមត្រូវ។",
    sendResetFailed: "មិនអាចផ្ញើលេខកូដកំណត់ឡើងវិញបានទេ។",

    otpTitle: "បញ្ចូលលេខកូដ OTP",
    otpNumber: "លេខកូដ OTP",
    otpSentTo: "បានផ្ញើទៅ",
    resend: "ផ្ញើម្តងទៀត",
    next: "បន្ទាប់",
    otpMissingEmail:
      "រកមិនឃើញអ៊ីមែល។ សូមចាប់ផ្ដើមពីទំព័រភ្លេចពាក្យសម្ងាត់។",
    otpIncomplete: "សូមបញ្ចូលលេខកូដ OTP ចំនួន ៦ ខ្ទង់។",
    otpResent: "លេខកូដ OTP ថ្មីត្រូវបានផ្ញើទៅអ៊ីមែលរបស់អ្នក។",
    otpResendFailed: "មិនអាចផ្ញើលេខកូដ OTP ម្តងទៀតបានទេ។",

    newPasswordTitle: "ពាក្យសម្ងាត់ថ្មី",
    newPassword: "ពាក្យសម្ងាត់ថ្មី",
    newPasswordPlaceholder: "បញ្ចូលពាក្យសម្ងាត់ថ្មី",
    confirmPassword: "បញ្ជាក់ពាក្យសម្ងាត់",
    confirmPasswordPlaceholder: "បញ្ចូលពាក្យសម្ងាត់ម្តងទៀត",
    confirm: "បញ្ជាក់",
    saving: "កំពុងរក្សាទុក...",
    newPasswordRequired: "សូមបញ្ចូលពាក្យសម្ងាត់ថ្មី។",
    passwordTooShort: "ពាក្យសម្ងាត់ត្រូវមានយ៉ាងតិច ៨ តួអក្សរ។",
    confirmPasswordRequired: "សូមបញ្ជាក់ពាក្យសម្ងាត់របស់អ្នក។",
    passwordsDoNotMatch: "ពាក្យសម្ងាត់មិនដូចគ្នាទេ។",
    resetMissingDetails:
      "រកមិនឃើញអ៊ីមែល ឬលេខកូដ OTP។ សូមចាប់ផ្ដើមពីទំព័រភ្លេចពាក្យសម្ងាត់។",
    resetFailed: "មិនអាចកំណត់ពាក្យសម្ងាត់ឡើងវិញបានទេ។",
  },
};

export type AuthText = (typeof authText)["en"];

export function useAuthText(): AuthText {
  const { language } = useAppLanguage();

  return authText[language === "kh" ? "kh" : "en"];
}
