#!/bin/bash

# Gooneral Wheelchair - One-Line Deployment for Linux/macOS
# Usage: ./deploy-now.sh yourdomain.com [server-host] [server-user]

# Colors for output
RED='\033[0;31m'
GREEN='\033[0;32m'
YELLOW='\033[1;33m'
BLUE='\033[0;34m'
CYAN='\033[0;36m'
NC='\033[0m' # No Color

DOMAIN="$1"
SERVER_HOST="$2"
SERVER_USER="${3:-root}"

if [ -z "$DOMAIN" ]; then
    echo -e "${RED}❌ Error: Domain name is required${NC}"
    echo ""
    echo "Usage Examples:"
    echo "  $0 yourdomain.com                    # Create deployment package"
    echo "  $0 yourdomain.com server-ip          # Deploy directly to server" 
    echo "  $0 yourdomain.com server-ip username # Deploy with custom user"
    exit 1
fi

echo -e "${GREEN}🚀 Gooneral Wheelchair - One-Line Deploy${NC}"
echo -e "${CYAN}📁 Domain: $DOMAIN${NC}"
if [ -n "$SERVER_HOST" ]; then
    echo -e "${CYAN}🌐 Server: $SERVER_HOST${NC}"
fi

if [ -n "$SERVER_HOST" ]; then
    echo -e "${GREEN}🚀 Running full deployment to server...${NC}"
    ./prepare-deployment.sh "$DOMAIN" "$SERVER_HOST" "$SERVER_USER"
else
    echo -e "${GREEN}📦 Preparing deployment package...${NC}"
    ./prepare-deployment.sh "$DOMAIN"
    
    echo ""
    echo -e "${YELLOW}✨ Want to deploy directly to your server?${NC}"
    echo -e "${BLUE}Run: $0 $DOMAIN your.server.ip username${NC}"
fi