#!/bin/bash

echo "=========================================="
echo "  SKYARTSHOP HTTPS CONFIGURATION STATUS"
echo "=========================================="
echo ""

echo "✅ Server Configuration:"
echo "   - Backend: Running on port 5000"
echo "   - Nginx HTTPS: Listening on port 443"
echo "   - SSL Certificates: Valid"
echo ""

echo "✅ Local Testing (Working):"
echo "   - http://localhost/admin/login ✓"
echo "   - https://localhost/admin/login ✓"
echo ""

echo "🌐 Network Configuration:"
echo "   - Server Private IP: $(hostname -I | awk '{print $1}')"
echo "   - Public IP (DNS): $(nslookup skyarts.ddns.net 2>/dev/null | grep "Address:" | tail -1 | awk '{print $2}')"
echo "   - Domain: skyarts.ddns.net"
echo ""

echo "🔥 Firewall Status:"
sudo ufw status | grep -E "443|Status"
echo ""

echo "🔌 Port Status:"
ss -tlnp 2>/dev/null | grep -E ":(80|443|5000)" | awk '{print "   "$1" "$4}'
echo ""

echo "=========================================="
echo "  ACTION REQUIRED"
echo "=========================================="
echo ""
echo "Your server is behind a router/NAT."
echo "To make https://skyarts.ddns.net accessible:"
echo ""
echo "1. LOG INTO YOUR ROUTER"
echo "   IP: Check your router's IP (usually 192.168.10.1)"
echo ""
echo "2. SET UP PORT FORWARDING:"
echo "   External Port: 443"
echo "   Internal IP: 192.168.10.130"
echo "   Internal Port: 443"
echo "   Protocol: TCP"
echo ""
echo "3. ALSO FORWARD (if not already done):"
echo "   External Port: 80"
echo "   Internal IP: 192.168.10.130"
echo "   Internal Port: 80"
echo "   Protocol: TCP"
echo ""
echo "=========================================="
echo "  TEST AFTER PORT FORWARDING"
echo "=========================================="
echo ""
echo "Once port forwarding is configured:"
echo ""
echo "1. From your browser:"
echo "   https://skyarts.ddns.net"
echo "   https://skyarts.ddns.net/admin/login"
echo ""
echo "2. Login credentials:"
echo "   Email: admin@example.com"
echo "   Password: Admin123"
echo ""
echo "=========================================="
