-- FellowKick Localization System
-- Supports: English (en), Spanish (es), Russian (ru), Korean (ko)

local _, FellowKick = ...
FellowKick.Locales = FellowKick.Locales or {}

-- Default language
FellowKick.CurrentLocale = "en"

-- Locale tables
local L = {}

-- =====================
-- ENGLISH (Default)
-- =====================
L["en"] = {
    -- General
    ["addon_name"] = "FellowKick",
    ["version"] = "v1.2",
    ["author"] = "Author: Grondy",
    ["description"] = "Interrupt coordination for M+",
    
    -- Panel titles
    ["options_title"] = "FellowKick Options",
    ["group_frame"] = "Group Frame",
    ["macros_section"] = "Focus Macros",
    
    -- Position
    ["position"] = "Position:",
    ["top"] = "Top",
    ["left"] = "Left", 
    ["right"] = "Right",
    
    -- Scales
    ["nameplate_scale"] = "Nameplate icon scale:",
    ["group_scale"] = "Group frame scale:",
    ["scale"] = "Scale:",
    ["x_offset"] = "X Offset:",
    ["y_offset"] = "Y Offset:",
    
    -- Roles
    ["your_role"] = "Your role (predefined marker):",
    ["tank"] = "Tank (Square)",
    ["healer"] = "Healer (Triangle)",
    ["dps1"] = "DPS 1 (Star)",
    ["dps2"] = "DPS 2 (Diamond)",
    ["dps3"] = "DPS 3 (Skull)",
    ["none"] = "None",
    ["role_assigned"] = "Role assigned:",
    
    -- Macros
    ["create_macros_desc"] = "Creates 5 macros: Focus + Marker for each role",
    ["create_macros_btn"] = "Create Focus Macros",
    ["macros_info"] = "Macros created: FK Tank, FK Healer, FK DPS1, FK DPS2, FK DPS3\nEach macro does /focus and sets the role marker",
    ["macros_created"] = "Created %d new macros",
    ["macros_skipped"] = "%d macros already existed (skipped)",
    ["macros_no_space"] = "No space for macro:",
    ["macros_failed"] = "Could not create macros",
    
    -- Language
    ["language"] = "Language:",
    ["language_changed"] = "Language changed to: English",
    
    -- Group frame
    ["group"] = "Group",
    ["waiting"] = "Waiting...",
    ["btn_help"] = "Help / Manual",
    
    -- Commands
    ["cmd_help"] = "Available commands:",
    ["cmd_role"] = "Assign your role (tank, heal, dps1, dps2, dps3)",
    ["cmd_debug"] = "NPC ID info of your target",
    ["cmd_test"] = "Try to mark your target manually",
    ["cmd_list"] = "See how many mobs in database",
    ["cmd_status"] = "See current configuration",
    ["cmd_group"] = "See group markers",
    
    -- Misc
    ["available_roles"] = "Available roles:",
    ["your_current_role"] = "Your current role:",
    ["predefined_marks_init"] = "Predefined marks initialized",
    
    -- User Manual
    ["howto_title"] = "How to use",
    ["howto_role"] = "1. Select your role in the 'Your Role' dropdown.",
    ["howto_macro_btn"] = "2. Click the 'Create Focus Macros' button.",
    ["howto_macro_use"] = "3. Use the created macros (e.g. FK Tank) to set Focus + Mark.",
    ["howto_note"] = "Note: Using the focus interrupt macro is optional but recommended.",
}

-- =====================
-- SPANISH (Español)
-- =====================
L["es"] = {
    -- General
    ["addon_name"] = "FellowKick",
    ["version"] = "v1.2",
    ["author"] = "Autor: Grondy",
    ["description"] = "Coordinación de cortes para M+",
    
    -- Panel titles
    ["options_title"] = "Opciones de FellowKick",
    ["group_frame"] = "Marco de Grupo",
    ["macros_section"] = "Macros de Focus",
    
    -- Position
    ["position"] = "Posición:",
    ["top"] = "Arriba",
    ["left"] = "Izquierda",
    ["right"] = "Derecha",
    
    -- Scales
    ["nameplate_scale"] = "Escala del icono (Nameplate):",
    ["group_scale"] = "Escala del marco de grupo:",
    ["scale"] = "Escala:",
    ["x_offset"] = "Desplazamiento X:",
    ["y_offset"] = "Desplazamiento Y:",
    
    -- Roles
    ["your_role"] = "Tu rol (marca predefinida):",
    ["tank"] = "Tank (Cuadrado)",
    ["healer"] = "Healer (Triángulo)",
    ["dps1"] = "DPS 1 (Estrella)",
    ["dps2"] = "DPS 2 (Diamante)",
    ["dps3"] = "DPS 3 (Calavera)",
    ["none"] = "Ninguno",
    ["role_assigned"] = "Rol asignado:",
    
    -- Macros
    ["create_macros_desc"] = "Crea 5 macros: Focus + Marca para cada rol",
    ["create_macros_btn"] = "Crear Macros de Focus",
    ["macros_info"] = "Macros creados: FK Tank, FK Healer, FK DPS1, FK DPS2, FK DPS3\nCada macro hace /focus y pone la marca del rol",
    ["macros_created"] = "Creados %d macros nuevos",
    ["macros_skipped"] = "%d macros ya existían (omitidos)",
    ["macros_no_space"] = "No hay espacio para macro:",
    ["macros_failed"] = "No se pudieron crear macros",
    
    -- Language
    ["language"] = "Idioma:",
    ["language_changed"] = "Idioma cambiado a: Español",
    
    -- Group frame
    ["group"] = "Grupo",
    ["waiting"] = "Esperando...",
    ["btn_help"] = "Ayuda / Manual",
    
    -- Commands
    ["cmd_help"] = "Comandos disponibles:",
    ["cmd_role"] = "Asignar tu rol (tank, heal, dps1, dps2, dps3)",
    ["cmd_debug"] = "Info del NPC ID de tu target",
    ["cmd_test"] = "Intentar marcar tu target manualmente",
    ["cmd_list"] = "Ver cuántos mobs en la base de datos",
    ["cmd_status"] = "Ver configuración actual",
    ["cmd_group"] = "Ver marcadores del grupo",
    
    -- Misc
    ["available_roles"] = "Roles disponibles:",
    ["your_current_role"] = "Tu rol actual:",
    ["predefined_marks_init"] = "Marcas predefinidas inicializadas",

    -- User Manual
    ["howto_title"] = "Manual de usuario",
    ["howto_role"] = "1. Selecciona tu rol en el menú 'Tu rol'.",
    ["howto_macro_btn"] = "2. Haz clic en el botón 'Crear Macros de Focus'.",
    ["howto_macro_use"] = "3. Usa los macros creados (ej. FK Tank) para poner Focus + Marca.",
    ["howto_note"] = "Nota: El uso de macro de corte al focus es opcional pero recomendado.",
}

-- =====================
-- RUSSIAN (Русский)
-- =====================
L["ru"] = {
    -- General
    ["addon_name"] = "FellowKick",
    ["version"] = "v1.2",
    ["author"] = "Автор: Grondy",
    ["description"] = "Координация прерываний для М+",
    
    -- Panel titles
    ["options_title"] = "Настройки FellowKick",
    ["group_frame"] = "Фрейм группы",
    ["macros_section"] = "Макросы фокуса",
    
    -- Position
    ["position"] = "Позиция:",
    ["top"] = "Сверху",
    ["left"] = "Слева",
    ["right"] = "Справа",
    
    -- Scales
    ["nameplate_scale"] = "Масштаб иконки (Nameplate):",
    ["group_scale"] = "Масштаб фрейма группы:",
    ["scale"] = "Масштаб:",
    ["x_offset"] = "Смещение X:",
    ["y_offset"] = "Смещение Y:",
    
    -- Roles
    ["your_role"] = "Твоя роль (метка):",
    ["tank"] = "Танк (Квадрат)",
    ["healer"] = "Хилер (Треугольник)",
    ["dps1"] = "ДПС 1 (Звезда)",
    ["dps2"] = "ДПС 2 (Ромб)",
    ["dps3"] = "ДПС 3 (Череп)",
    ["none"] = "Нет",
    ["role_assigned"] = "Роль назначена:",
    
    -- Macros
    ["create_macros_desc"] = "Создать 5 макросов: Фокус + Метка для каждой роли",
    ["create_macros_btn"] = "Создать макросы фокуса",
    ["macros_info"] = "Создано: FK Tank, FK Healer, FK DPS1, FK DPS2, FK DPS3\nКаждый макрос делает /focus и ставит метку",
    ["macros_created"] = "Создано %d новых макросов",
    ["macros_skipped"] = "%d макросов уже существует (пропущено)",
    ["macros_no_space"] = "Нет места для макроса:",
    ["macros_failed"] = "Не удалось создать макросы",
    
    -- Language
    ["language"] = "Язык:",
    ["language_changed"] = "Язык изменён на: Русский",
    
    -- Group frame
    ["group"] = "Группа",
    ["waiting"] = "Ожидание...",
    ["btn_help"] = "Помощь / Мануал",
    
    -- Commands
    ["cmd_help"] = "Доступные команды:",
    ["cmd_role"] = "Назначить роль (tank, heal, dps1, dps2, dps3)",
    ["cmd_debug"] = "Информация о NPC ID цели",
    ["cmd_test"] = "Попытаться пометить цель вручную",
    ["cmd_list"] = "Количество мобов в базе данных",
    ["cmd_status"] = "Текущая конфигурация",
    ["cmd_group"] = "Метки группы",
    
    -- Misc
    ["available_roles"] = "Доступные роли:",
    ["your_current_role"] = "Твоя текущая роль:",
    ["predefined_marks_init"] = "Метки инициализированы",

    -- User Manual
    ["howto_title"] = "Руководство пользователя",
    ["howto_role"] = "1. Выберите свою роль в меню 'Твоя роль'.",
    ["howto_macro_btn"] = "2. Нажмите кнопку 'Создать макросы фокуса'.",
    ["howto_macro_use"] = "3. Используйте созданные макросы (напр. FK Tank) для Фокуса + Метки.",
    ["howto_note"] = "Примечание: Использование макроса прерывания по фокусу рекомендуется.",
}

-- =====================
-- KOREAN (한국어)
-- =====================
L["ko"] = {
    -- General
    ["addon_name"] = "FellowKick",
    ["version"] = "v1.2",
    ["author"] = "제작자: Grondy",
    ["description"] = "M+ 차단 조율",
    
    -- Panel titles
    ["options_title"] = "FellowKick 설정",
    ["group_frame"] = "그룹 프레임",
    ["macros_section"] = "주시 대상 매크로",
    
    -- Position
    ["position"] = "위치:",
    ["top"] = "위",
    ["left"] = "왼쪽",
    ["right"] = "오른쪽",
    
    -- Scales
    ["nameplate_scale"] = "이름표 아이콘 크기:",
    ["group_scale"] = "그룹 프레임 크기:",
    ["scale"] = "크기:",
    ["x_offset"] = "X 좌표 조정:",
    ["y_offset"] = "Y 좌표 조정:",
    
    -- Roles
    ["your_role"] = "당신의 역할 (징표):",
    ["tank"] = "탱커 (네모)",
    ["healer"] = "힐러 (세모)",
    ["dps1"] = "딜러 1 (별)",
    ["dps2"] = "딜러 2 (다이아)",
    ["dps3"] = "딜러 3 (해골)",
    ["none"] = "없음",
    ["role_assigned"] = "역할 지정됨:",
    
    -- Macros
    ["create_macros_desc"] = "5개 매크로 생성: 주시 대상 + 역할별 징표",
    ["create_macros_btn"] = "주시 매크로 생성",
    ["macros_info"] = "생성됨: FK Tank, FK Healer, FK DPS1, FK DPS2, FK DPS3\n각 매크로는 /focus 및 징표 설정",
    ["macros_created"] = "%d개의 새 매크로 생성",
    ["macros_skipped"] = "%d개의 매크로가 이미 존재 (건너뜀)",
    ["macros_no_space"] = "매크로 공간 부족:",
    ["macros_failed"] = "매크로 생성 실패",
    
    -- Language
    ["language"] = "언어:",
    ["language_changed"] = "언어 변경됨: 한국어",
    
    -- Group frame
    ["group"] = "그룹",
    ["waiting"] = "대기 중...",
    ["btn_help"] = "도움말 / 매뉴얼",
    
    -- Commands
    ["cmd_help"] = "사용 가능한 명령어:",
    ["cmd_role"] = "역할 지정 (tank, heal, dps1, dps2, dps3)",
    ["cmd_debug"] = "대상 NPC ID 정보",
    ["cmd_test"] = "대상 수동 마킹 시도",
    ["cmd_list"] = "데이터베이스 몹 수 확인",
    ["cmd_status"] = "현재 설정 확인",
    ["cmd_group"] = "그룹 징표 확인",
    
    -- Misc
    ["available_roles"] = "사용 가능한 역할:",
    ["your_current_role"] = "현재 역할:",
    ["predefined_marks_init"] = "기본 징표 초기화됨",
    
    -- User Manual
    ["howto_title"] = "사용 매뉴얼",
    ["howto_role"] = "1. '당신의 역할' 메뉴에서 역할을 선택하세요.",
    ["howto_macro_btn"] = "2. '주시 매크로 생성' 버튼을 클릭하세요.",
    ["howto_macro_use"] = "3. 생성된 매크로(예: FK Tank)를 사용하여 주시 + 징표를 설정하세요.",
    ["howto_note"] = "참고: 주시 대상 차단 매크로 사용은 선택 사항이지만 권장됩니다.",
}

-- Store all locales
FellowKick.Locales = L

-- Get localized string function
function FellowKick.L(key)
    local locale = FellowKickDB and FellowKickDB.locale or "en"
    if L[locale] and L[locale][key] then
        return L[locale][key]
    elseif L["en"] and L["en"][key] then
        return L["en"][key]  -- Fallback to English
    end
    return key  -- Return key if not found
end

-- Get available languages (for dropdown)
FellowKick.AvailableLanguages = {
    { code = "en", name = "English" },
    { code = "es", name = "Español" },
    { code = "ru", name = "Русский" },
    { code = "ko", name = "한국어" },
}
