#!/bin/bash
# Helper script to create .env file from .env.example

SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
API_DIR="$(cd "$SCRIPT_DIR/.." && pwd)"

cd "$API_DIR"

if [ -f .env ]; then
  echo "⚠ .env file already exists. Skipping creation."
  echo "If you want to recreate it, delete .env first."
  exit 0
fi

if [ ! -f .env.example ]; then
  echo "❌ .env.example not found. Cannot create .env file."
  exit 1
fi

echo "Creating .env file from .env.example..."
cp .env.example .env

echo ""
echo "✅ .env file created!"
echo ""
echo "⚠ IMPORTANT: Please edit .env and set your database password:"
echo "   DB_PASSWORD=your_secure_password_here"
echo ""
echo "For development: minimum 8 characters"
echo "For production: minimum 32 characters with uppercase, lowercase, numbers, and special characters"
echo ""
