// Spanish translations
import commonEs from './es/common.json';
import authEs from './es/auth.json';
import inventoryEs from './es/inventory.json';
import foodSafetyEs from './es/foodSafety.json';
import suppliersEs from './es/suppliers.json';
import ordersEs from './es/orders.json';
import recipesEs from './es/recipes.json';
import errorsEs from './es/errors.json';
import dashboardEs from './es/dashboard.json';
import productionEs from './es/production.json';
import equipmentEs from './es/equipment.json';
import landingEs from './es/landing.json';
import settingsEs from './es/settings.json';
import ajustesEs from './es/ajustes.json';
import reasoningEs from './es/reasoning.json';
import wizardsEs from './es/wizards.json';
import subscriptionEs from './es/subscription.json';
import purchaseOrdersEs from './es/purchase_orders.json';
import helpEs from './es/help.json';
import featuresEs from './es/features.json';
import aboutEs from './es/about.json';
import demoEs from './es/demo.json';
import blogEs from './es/blog.json';
import alertsEs from './es/alerts.json';
import onboardingEs from './es/onboarding.json';
import setupWizardEs from './es/setup_wizard.json';
import contactEs from './es/contact.json';
import premisesEs from './es/premises.json';

// English translations
import commonEn from './en/common.json';
import authEn from './en/auth.json';
import inventoryEn from './en/inventory.json';
import foodSafetyEn from './en/foodSafety.json';
import suppliersEn from './en/suppliers.json';
import ordersEn from './en/orders.json';
import recipesEn from './en/recipes.json';
import errorsEn from './en/errors.json';
import dashboardEn from './en/dashboard.json';
import productionEn from './en/production.json';
import equipmentEn from './en/equipment.json';
import landingEn from './en/landing.json';
import settingsEn from './en/settings.json';
import ajustesEn from './en/ajustes.json';
import reasoningEn from './en/reasoning.json';
import wizardsEn from './en/wizards.json';
import subscriptionEn from './en/subscription.json';
import purchaseOrdersEn from './en/purchase_orders.json';
import helpEn from './en/help.json';
import featuresEn from './en/features.json';
import aboutEn from './en/about.json';
import demoEn from './en/demo.json';
import blogEn from './en/blog.json';
import alertsEn from './en/alerts.json';
import onboardingEn from './en/onboarding.json';
import setupWizardEn from './en/setup_wizard.json';
import contactEn from './en/contact.json';
import premisesEn from './en/premises.json';

// Basque translations
import commonEu from './eu/common.json';
import authEu from './eu/auth.json';
import inventoryEu from './eu/inventory.json';
import foodSafetyEu from './eu/foodSafety.json';
import suppliersEu from './eu/suppliers.json';
import ordersEu from './eu/orders.json';
import recipesEu from './eu/recipes.json';
import errorsEu from './eu/errors.json';
import dashboardEu from './eu/dashboard.json';
import productionEu from './eu/production.json';
import equipmentEu from './eu/equipment.json';
import landingEu from './eu/landing.json';
import settingsEu from './eu/settings.json';
import ajustesEu from './eu/ajustes.json';
import reasoningEu from './eu/reasoning.json';
import wizardsEu from './eu/wizards.json';
import subscriptionEu from './eu/subscription.json';
import purchaseOrdersEu from './eu/purchase_orders.json';
import helpEu from './eu/help.json';
import featuresEu from './eu/features.json';
import aboutEu from './eu/about.json';
import demoEu from './eu/demo.json';
import blogEu from './eu/blog.json';
import alertsEu from './eu/alerts.json';
import onboardingEu from './eu/onboarding.json';
import setupWizardEu from './eu/setup_wizard.json';
import contactEu from './eu/contact.json';
import premisesEu from './eu/premises.json';

// Translation resources by language
export const resources = {
 es: {
    common: commonEs,
    auth: authEs,
    inventory: inventoryEs,
    foodSafety: foodSafetyEs,
    suppliers: suppliersEs,
    orders: ordersEs,
    recipes: recipesEs,
    errors: errorsEs,
    dashboard: dashboardEs,
    production: productionEs,
    equipment: equipmentEs,
    landing: landingEs,
    settings: settingsEs,
    ajustes: ajustesEs,
    reasoning: reasoningEs,
    wizards: wizardsEs,
    subscription: subscriptionEs,
    purchase_orders: purchaseOrdersEs,
    help: helpEs,
    features: featuresEs,
    about: aboutEs,
    demo: demoEs,
    blog: blogEs,
    alerts: alertsEs,
    onboarding: onboardingEs,
    setup_wizard: setupWizardEs,
    contact: contactEs,
    premises: premisesEs,
  },
  en: {
    common: commonEn,
    auth: authEn,
    inventory: inventoryEn,
    foodSafety: foodSafetyEn,
    suppliers: suppliersEn,
    orders: ordersEn,
    recipes: recipesEn,
    errors: errorsEn,
    dashboard: dashboardEn,
    production: productionEn,
    equipment: equipmentEn,
    landing: landingEn,
    settings: settingsEn,
    ajustes: ajustesEn,
    reasoning: reasoningEn,
    wizards: wizardsEn,
    subscription: subscriptionEn,
    purchase_orders: purchaseOrdersEn,
    help: helpEn,
    features: featuresEn,
    about: aboutEn,
    demo: demoEn,
    blog: blogEn,
    alerts: alertsEn,
    onboarding: onboardingEn,
    setup_wizard: setupWizardEn,
    contact: contactEn,
    premises: premisesEn,
  },
  eu: {
    common: commonEu,
    auth: authEu,
    inventory: inventoryEu,
    foodSafety: foodSafetyEu,
    suppliers: suppliersEu,
    orders: ordersEu,
    recipes: recipesEu,
    errors: errorsEu,
    dashboard: dashboardEu,
    production: productionEu,
    equipment: equipmentEu,
    landing: landingEu,
    settings: settingsEu,
    ajustes: ajustesEu,
    reasoning: reasoningEu,
    wizards: wizardsEu,
    subscription: subscriptionEu,
    purchase_orders: purchaseOrdersEu,
    help: helpEu,
    features: featuresEu,
    about: aboutEu,
    demo: demoEu,
    blog: blogEu,
    alerts: alertsEu,
    onboarding: onboardingEu,
    setup_wizard: setupWizardEu,
    contact: contactEu,
    premises: premisesEu,
  },
};

// Supported languages
export const supportedLanguages = ['es', 'en', 'eu'] as const;
export type SupportedLanguage = typeof supportedLanguages[number];

// Default language
export const defaultLanguage: SupportedLanguage = 'es';

// Language configuration
export const languageConfig = {
  es: {
    name: 'Español',
    nativeName: 'Español',
    code: 'es',
    flag: 'es', // Using language code instead of flag for proper language identification
    rtl: false,
  },
  en: {
    name: 'English',
    nativeName: 'English',
    code: 'en',
    flag: 'en', // Using language code instead of flag for proper language identification
    rtl: false,
  },
  eu: {
    name: 'Basque',
    nativeName: 'Euskera',
    code: 'eu',
    flag: 'eu', // Using language code instead of flag for proper language identification
    rtl: false,
  },
};

// Namespaces available in translations
export const namespaces = ['common', 'auth', 'inventory', 'foodSafety', 'suppliers', 'orders', 'recipes', 'errors', 'dashboard', 'production', 'equipment', 'landing', 'settings', 'ajustes', 'reasoning', 'wizards', 'subscription', 'purchase_orders', 'help', 'features', 'about', 'demo', 'blog', 'alerts', 'onboarding', 'setup_wizard', 'contact', 'premises'] as const;
export type Namespace = typeof namespaces[number];

// Helper function to get language display name
export const getLanguageDisplayName = (language: SupportedLanguage): string => {
  return languageConfig[language]?.nativeName || language;
};

// Helper function to check if language is supported
export const isSupportedLanguage = (language: string): language is SupportedLanguage => {
  return supportedLanguages.includes(language as SupportedLanguage);
};

// Export individual language modules for direct imports
export { commonEs, authEs, inventoryEs, foodSafetyEs, suppliersEs, ordersEs, recipesEs, errorsEs, equipmentEs, landingEs, settingsEs, ajustesEs, reasoningEs, wizardsEs, wizardsEn, wizardsEu, helpEs, helpEn, helpEu, featuresEs, featuresEn, featuresEu, aboutEs, aboutEn, aboutEu, demoEs, demoEn, demoEu, blogEs, blogEn, blogEu };

// Default export with all translations
export default resources;
