#!/usr/bin/env python3
"""
Minimal Terminal-Style Boot Logo Generator
Nur Text, wie in einem echten Terminal
"""

from PIL import Image, ImageDraw, ImageFont
import os

# Terminal-Farbschema
BG_BLACK = (12, 12, 15)
TEXT_GREEN = (0, 255, 100)
TEXT_WHITE = (230, 230, 230)
TEXT_GRAY = (120, 120, 120)
TEXT_CYAN = (100, 200, 255)

# Bildgröße
WIDTH = 800
HEIGHT = 600

# Erstelle Bild
img = Image.new('RGB', (WIDTH, HEIGHT), BG_BLACK)
draw = ImageDraw.Draw(img)

# Versuche Monospace-Font zu laden
try:
    font_paths = [
        '/usr/share/fonts/truetype/dejavu/DejaVuSansMono.ttf',
        '/usr/share/fonts/truetype/dejavu/DejaVuSansMono-Bold.ttf',
        '/usr/share/fonts/truetype/liberation/LiberationMono-Regular.ttf',
        '/usr/share/fonts/truetype/liberation2/LiberationMono-Regular.ttf',
    ]

    font_large = None
    font_medium = None
    font_small = None

    for font_path in font_paths:
        if os.path.exists(font_path):
            font_large = ImageFont.truetype(font_path, 56)
            font_medium = ImageFont.truetype(font_path, 28)
            font_small = ImageFont.truetype(font_path, 22)
            break

    if not font_large:
        raise Exception("No font found")

except:
    print("Monospace font nicht gefunden, nutze Default-Font")
    font_large = ImageFont.load_default()
    font_medium = ImageFont.load_default()
    font_small = ImageFont.load_default()

# Start-Position
x_offset = 60
y_offset = 120
line_height = 40

# Terminal-Output simulieren
lines = [
    ("Booting system...", TEXT_GRAY, font_medium),
    ("", TEXT_GRAY, font_medium),
    ("RDP THIN CLIENT SYSTEM", TEXT_WHITE, font_large),
    ("", TEXT_GRAY, font_medium),
    ("[  OK  ] Remote Desktop Protocol initialized", TEXT_GREEN, font_medium),
    ("[  OK  ] Graphics subsystem ready", TEXT_GREEN, font_medium),
    ("[  OK  ] Audio redirection enabled", TEXT_GREEN, font_medium),
    ("[  OK  ] USB device support active", TEXT_GREEN, font_medium),
    ("[  OK  ] Network services started", TEXT_GREEN, font_medium),
    ("", TEXT_GRAY, font_medium),
]

current_y = y_offset
for line_text, color, font in lines:
    if line_text:  # Leere Zeilen überspringen
        draw.text((x_offset, current_y), line_text, font=font, fill=color)
    # Größere Abstände für Title
    if font == font_large:
        current_y += 80
    else:
        current_y += line_height

# Cursor am Ende
cursor_y = current_y
draw.rectangle([x_offset, cursor_y, x_offset + 12, cursor_y + 22], fill=TEXT_GREEN)

# Footer (rechts neben dem Cursor, zentriert)
footer_text = "HackerSoft · Hacker-Net Telekommunikation"
footer_x = x_offset + 20  # 20px rechts vom Cursor
draw.text((footer_x, cursor_y), footer_text, font=font_small, fill=TEXT_GRAY)

# Speichern
output_path = os.path.join(os.path.dirname(__file__), 'boot-logo.png')
img.save(output_path, 'PNG')
print(f"Minimal Terminal Boot-Logo erstellt: {output_path}")
print(f"Größe: {WIDTH}x{HEIGHT}")
