#!/bin/bash

# Script to update API server via Gitea
# Since we can't SSH directly, we'll use the API server to pull latest code

echo "🚀 Updating API server with latest code..."

# Create a deployment trigger endpoint
curl -X POST https://api.filamenteka.rs/deploy \
  -H "Content-Type: application/json" \
  -H "X-Deploy-Secret: ${DEPLOY_SECRET}" \
  -d '{"action": "pull_latest"}' \
  2>/dev/null || echo "Deploy endpoint not available"

echo ""
echo "⚠️  Manual update required:"
echo "The API server needs to be updated with the latest code that removes brand references."
echo ""
echo "The server file api/server.js needs these changes:"
echo "1. Remove 'brand' from the INSERT statement on line ~115"
echo "2. Remove 'brand' from the UPDATE statement on line ~140"
echo "3. Remove 'brand' from the destructuring on lines ~111 and ~136"
echo ""
echo "Current server expects: (brand, tip, finish, boja, ...)"
echo "Should be: (tip, finish, boja, ...)"