#!/bin/bash
set -euo pipefail
REMOTE="aissa@10.4.7.18"
PASS='Foodlinkk#2026'
SRC="/tmp/foodlinkk-deploy"
DEST="~/foodlinkk-command-center"

sshpass -p "$PASS" rsync -avz --relative \
  "$SRC/./cockpit/" "$SRC/./tools-api/app/comfyui.py" "$SRC/./tools-api/app/main.py" \
  "$SRC/./tools-api/app/retail_360_routes.py" \
  "$REMOTE:$DEST/"

sshpass -p "$PASS" ssh -o StrictHostKeyChecking=no "$REMOTE" 'cd ~/foodlinkk-command-center && docker compose build tools-api cockpit && docker compose up -d tools-api cockpit && sleep 4 && curl -sf http://localhost:8600/api/server-time && echo && curl -sf http://localhost:8600/reports/api/datasets | head -c 150 && echo'
sshpass -p 'Foodlinkk#2026' ssh -o StrictHostKeyChecking=no aissa@10.4.7.19 'python3 ~/foodlinkk-ai/hermes/notify.py --team "UI upgrade: verticale nav, Herman zonder RSS, reclame tab, agent avatars, retail filters, ComfyUI neg prompt, Reports export — http://10.4.7.18:8600"' 2>/dev/null || true
echo "Deploy done."
