
import os

base_path = r"c:\Users\joao.goncalves\Desktop\manuais zammad"

folders = {
    "documentacao web servers": ["Nginx", "Apache"],
    "documentacao ftp": ["FTP", "SFTP"],
    "documentacao endpoint": ["ManageEngine"],
    "documentacao webmin": ["Webmin"],
    "documentacao editores": ["Nano", "Vim"],
    "documentacao terminal": ["Linux", "Windows"],
    "documentacao agendamento": ["Cron", "Task Scheduler"],
    "documentacao diagnostico rede": ["Ping", "Traceroute", "Netstat"],
    "documentacao certificados": ["Certbot", "Lets Encrypt"],
    "documentacao backup": ["Veeam"],
    "documentacao colaboracao": ["Nextcloud", "Office Online"],
    "documentacao microsoft": ["Windows Desktop", "Office", "Exchange"],
    "documentacao seguranca email": ["PMG", "Proxmox Mail Gateway"],
    "documentacao unifi": ["Unifi Controller"],
    "documentacao powerbi": ["PowerBI"],
    "documentacao dev": ["VSCode Server"],
    "documentacao zammad": ["Service Desk"],
    "documentacao hardware": ["Servers", "UPS"],
    "documentacao automacao": ["PowerShell", "Bash", "Ansible"],
    "documentacao processos": ["SOPs", "Onboarding", "Incidentes"]
}

subfolders = ["Nivel_0", "Nivel_1", "Nivel_2", "Nivel_3"]

def create_structure():
    print(f"Starting directory creation in {base_path}...")
    created_count = 0
    
    for folder, tags in folders.items():
        folder_path = os.path.join(base_path, folder)
        
        # Create main topic folder
        if not os.path.exists(folder_path):
            os.makedirs(folder_path)
            print(f"[NEW] Created folder: {folder}")
            created_count += 1
        else:
            print(f"[EXISTS] Folder: {folder}")
            
        # Create subfolders (Level 0-3)
        for sub in subfolders:
            sub_path = os.path.join(folder_path, sub)
            if not os.path.exists(sub_path):
                os.makedirs(sub_path)
                # Create a placeholder .keep file to validade emptiness if needed, purely optional
                # with open(os.path.join(sub_path, ".gitkeep"), 'w') as f: pass
                # print(f"  -> Created subfolder: {sub}")

    print(f"\nStructure creation complete. {created_count} new main directories created.")

if __name__ == "__main__":
    create_structure()
