#!/bin/bash

# Uninstall StreamFlow Update Server systemd service

SERVICE_NAME="streamflow-update-server"
SYSTEMD_DIR="$HOME/.config/systemd/user"

echo "🗑️  Uninstalling StreamFlow Update Server Service"
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"

# Stop the service
echo "⏹️  Stopping service"
systemctl --user stop "$SERVICE_NAME" 2>/dev/null

# Disable the service
echo "❌ Disabling service"
systemctl --user disable "$SERVICE_NAME" 2>/dev/null

# Remove service file
echo "📁 Removing service file"
rm -f "$SYSTEMD_DIR/$SERVICE_NAME.service"

# Reload systemd daemon
echo "🔄 Reloading systemd daemon"
systemctl --user daemon-reload

echo ""
echo "✅ Uninstallation complete!"
