import json
import os

def fix_admin_translations():
    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"] = {}
    
    # Tab
    if "tabs" not in data["admin"]: data["admin"]["tabs"] = {}
    data["admin"]["tabs"]["portfolio"] = {
        "en": "Portfolio", "me": "Portfolio", "ru": "Портфолио", "ua": "Портфоліо"
    }

    # Questions
    if "questions" not in data["admin"]: data["admin"]["questions"] = {}
    data["admin"]["questions"]["deletePhoto"] = {
        "en": "Are you sure you want to delete this photo?",
        "me": "Da li ste sigurni da želite obrisati ovu fotografiju?",
        "ru": "Вы уверены, что хотите удалить это фото?",
        "ua": "Ви впевнені, що хочете видалити це фото?"
    }

    # Toasts
    if "toasts" not in data["admin"]: data["admin"]["toasts"] = {}
    data["admin"]["toasts"]["photoDeleted"] = {
        "en": "Photo deleted successfully",
        "me": "Fotografija uspješno obrisana",
        "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_translations()
