import json
import os

def fix_admin_ui():
    path = os.path.join("src", "locales", "translations.json")
    with open(path, "r", encoding="utf-8") as f:
        data = json.load(f)

    if "admin" not in data: data["admin"] = {}
    
    # Statuses
    data["admin"]["statuses"] = {
        "pending": { "en": "Pending", "me": "Na čekanju", "ru": "Ожидание", "ua": "Очікування" },
        "processing": { "en": "Processing", "me": "Obrada", "ru": "В работе", "ua": "В роботі" },
        "shipped": { "en": "Shipped", "me": "Poslato", "ru": "Отправлено", "ua": "Відправлено" },
        "completed": { "en": "Completed", "me": "Završeno", "ru": "Завершено", "ua": "Завершено" },
        "cancelled": { "en": "Cancelled", "me": "Otkazano", "ru": "Отменено", "ua": "Скасовано" }
    }

    # Tabs
    data["admin"]["tabs"] = {
        "orders": { "en": "Orders", "me": "Narudžbe", "ru": "Заказы", "ua": "Замовлення" },
        "materials": { "en": "Materials", "me": "Materijali", "ru": "Материалы", "ua": "Матеріали" },
        "services": { "en": "Services", "me": "Usluge", "ru": "Услуги", "ua": "Послуги" },
        "users": { "en": "Users", "me": "Korisnici", "ru": "Пользователи", "ua": "Користувачі" },
        "posts": { "en": "Blog", "me": "Blog", "ru": "Блог", "ua": "Блог" }
    }

    with open(path, "w", encoding="utf-8") as f:
        json.dump(data, f, ensure_ascii=False, indent=2)

if __name__ == "__main__":
    fix_admin_ui()
