#!/bin/bash
set -e

case "$1" in
    configure)
        # Update icon cache
        if command -v gtk-update-icon-cache &> /dev/null; then
            gtk-update-icon-cache -f -t /usr/share/icons/hicolor 2>/dev/null || true
        fi

        # Update desktop database
        if command -v update-desktop-database &> /dev/null; then
            update-desktop-database /usr/share/applications 2>/dev/null || true
        fi

        echo ""
        echo "Praya Service installed successfully!"
        echo ""
        echo "To start the daemon:"
        echo "  praya-service                        # Run directly"
        echo "  systemctl --user start praya         # Start as service"
        echo "  systemctl --user enable praya        # Enable on login"
        echo ""
        echo "To enable features via D-Bus:"
        echo "  dbus-send --session --dest=com.github.blankon.praya \\"
        echo "    /com/github/blankon/Praya com.github.blankon.Praya.EnableService \\"
        echo "    string:'posture'"
        echo ""
        echo "Note: First run will download AI models (~30MB)."
        echo ""
        ;;
esac

#DEBHELPER#

exit 0
