[Unit]
Description=AI Dictation Service - Voice to Text with AI Conversation
Documentation=https://github.com/alphacep/vosk-api
After=graphical-session.target sound.target
Wants=sound.target
PartOf=graphical-session.target

[Service]
Type=simple
User=universal
Group=universal
WorkingDirectory=/mnt/storage/Development/dictation-service
EnvironmentFile=-/etc/environment
ExecStart=/bin/bash -c 'export DISPLAY=${DISPLAY:-:0}; export XAUTHORITY=${XAUTHORITY:-/home/universal/.Xauthority}; /mnt/storage/Development/dictation-service/.venv/bin/python src/dictation_service/ai_dictation_simple.py'
Restart=always
RestartSec=3
StandardOutput=journal
StandardError=journal

# Audio device permissions handled by user session

# Security settings
NoNewPrivileges=true
PrivateTmp=true
ProtectSystem=strict
ProtectHome=true
ReadWritePaths=/mnt/storage/Development/dictation-service
ReadWritePaths=/home/universal/.gemini/tmp/

[Install]
WantedBy=graphical-session.target