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

// Translations
const resources = {
    en: {
        translation: {
            // General
            "title": "VigIA Control",
            "logout": "Logout",
            "login_title": "Login",
            "login_subtitle": "Sign in to access the control panel",
            "username": "Username",
            "password": "Password",
            "sign_in": "Sign In",
            "welcome": "Welcome",

            // Admin Dashboard
            "monitor_area": "Monitor Area",
            "plate_approvals": "Plate Approvals",
            "user_management": "User Management",
            "visitor_approvals": "Visitor Approvals",
            "pending_approvals": "Pending Approvals",
            "approve": "Approve",
            "deny": "Deny",
            "all_plates": "All Registered Plates",
            "create_user": "Create New User",
            "user_list": "User List",
            "delete": "Delete",

            // User Dashboard
            "my_plates_title": "My Registered Plates",
            "register_plate": "Register New Plate",
            "plate_number": "Plate Number (e.g. AA-BB-11)",
            "owner_desc": "Owner / Description",
            "submit_plate": "Register Plate",
            "my_visitors_title": "My Visitors",
            "register_visitor": "Register Visitor",
            "visitor_rut": "RUT (12345678-9)",
            "full_name": "Full Name",
            "submit_visitor": "Register Visitor",
            "access_days": "Access Duration",
            "1_day": "1 Day Access",
            "2_days": "2 Days Access",
            "1_week": "1 Week Access",

            // Status
            "active": "ACTIVE",
            "pending": "PENDING",
            "denied": "DENIED",
            "approved": "APPROVED",

            // Messages
            "confirm_delete_plate": "Are you sure you want to delete this plate?",
            "confirm_delete_visitor": "Are you sure you want to delete this visitor?",

            // Visitor Check
            "visitor_check": "Visitor Check",
            "check_status": "Check Status",
            "enter_rut": "Enter RUT",
            "visitor_found": "Visitor Found",
            "visitor_not_found": "Visitor Not Found",
            "access_granted_until": "Access granted until",
            "registered_by": "Registered by",
            "no_record": "No record found for this RUT."
        }
    },
    es: {
        translation: {
            // General
            "title": "Control VigIA",
            "logout": "Cerrar sesión",
            "login_title": "Iniciar Sesión",
            "login_subtitle": "Ingresa para acceder al panel de control",
            "username": "Nombre de usuario",
            "password": "Contraseña",
            "sign_in": "Ingresar",
            "welcome": "Bienvenido",

            // Admin Dashboard
            "monitor_area": "Monitor",
            "plate_approvals": "Aprobación Patentes",
            "user_management": "Gestión Usuarios",
            "visitor_approvals": "Aprobación Visitas",
            "pending_approvals": "Aprobaciones Pendientes",
            "approve": "Aprobar",
            "deny": "Rechazar",
            "all_plates": "Todas las Patentes",
            "create_user": "Crear Usuario",
            "user_list": "Lista de Usuarios",
            "delete": "Eliminar",

            // User Dashboard
            "my_plates_title": "Mis Patentes Registradas",
            "register_plate": "Registrar Nueva Patente",
            "plate_number": "Patente (ej. AA-BB-11)",
            "owner_desc": "Propietario / Descripción",
            "submit_plate": "Registrar Patente",
            "my_visitors_title": "Mis Visitas",
            "register_visitor": "Registrar Visita",
            "visitor_rut": "RUT (12345678-9)",
            "full_name": "Nombre Completo",
            "submit_visitor": "Registrar Visita",
            "access_days": "Duración Acceso",
            "1_day": "Acceso 1 Día",
            "2_days": "Acceso 2 Días",
            "1_week": "Acceso 1 Semana",

            // Status
            "active": "ACTIVO",
            "pending": "PENDIENTE",
            "denied": "DENEGADO",
            "approved": "APROBADO",

            // Messages
            "confirm_delete_plate": "¿Estás seguro de que quieres eliminar esta patente?",
            "confirm_delete_visitor": "¿Estás seguro de que quieres eliminar esta visita?",

            // Visitor Check
            "visitor_check": "Consultar Visita",
            "check_status": "Verificar Estado",
            "enter_rut": "Ingresar RUT",
            "visitor_found": "Visita Encontrada",
            "visitor_not_found": "Visita No Encontrada",
            "access_granted_until": "Acceso permitido hasta",
            "registered_by": "Registrado por",
            "no_record": "No se encontró registro para este RUT."
        }
    }
};

i18n
    .use(initReactI18next)
    .init({
        resources,
        lng: "es", // Default language
        fallbackLng: "en",
        interpolation: {
            escapeValue: false
        }
    });

export default i18n;
