import i18n from 'i18next';
import { initReactI18next } from 'react-i18next';

import koCommon from './locales/ko/common.json';
import koDashboard from './locales/ko/dashboard.json';
import koDetection from './locales/ko/detection.json';
import koPatrol from './locales/ko/patrol.json';
import koEnforcement from './locales/ko/enforcement.json';
import koStatistics from './locales/ko/statistics.json';
import koAi from './locales/ko/ai.json';
import koFieldOps from './locales/ko/fieldOps.json';
import koAdmin from './locales/ko/admin.json';
import koAuth from './locales/ko/auth.json';

import enCommon from './locales/en/common.json';
import enDashboard from './locales/en/dashboard.json';
import enDetection from './locales/en/detection.json';
import enPatrol from './locales/en/patrol.json';
import enEnforcement from './locales/en/enforcement.json';
import enStatistics from './locales/en/statistics.json';
import enAi from './locales/en/ai.json';
import enFieldOps from './locales/en/fieldOps.json';
import enAdmin from './locales/en/admin.json';
import enAuth from './locales/en/auth.json';

i18n.use(initReactI18next).init({
  resources: {
    ko: {
      common: koCommon,
      dashboard: koDashboard,
      detection: koDetection,
      patrol: koPatrol,
      enforcement: koEnforcement,
      statistics: koStatistics,
      ai: koAi,
      fieldOps: koFieldOps,
      admin: koAdmin,
      auth: koAuth,
    },
    en: {
      common: enCommon,
      dashboard: enDashboard,
      detection: enDetection,
      patrol: enPatrol,
      enforcement: enEnforcement,
      statistics: enStatistics,
      ai: enAi,
      fieldOps: enFieldOps,
      admin: enAdmin,
      auth: enAuth,
    },
  },
  lng: 'ko',
  fallbackLng: 'ko',
  supportedLngs: ['ko', 'en'],
  defaultNS: 'common',
  ns: [
    'common',
    'dashboard',
    'detection',
    'patrol',
    'enforcement',
    'statistics',
    'ai',
    'fieldOps',
    'admin',
    'auth',
  ],
  interpolation: { escapeValue: false },
});

export default i18n;
