#!/bin/bash

# Setup script for the application
# This script installs dependencies and sets up the database

# Don't exit on pip error since it's optional
# set -e  # Exit on any error

echo "Setting up the application..."

# Install Python dependencies (though this project uses only standard library)
echo "Installing dependencies..."
if [ -f "requirements.txt" ]; then
    # Check if we can install packages
    if pip3 install -r requirements.txt 2>/dev/null; then
        echo "Dependencies installed successfully"
    else
        echo "Note: Using Python standard library only (no external dependencies required)"
    fi
else
    echo "No requirements.txt found - using Python standard library only"
fi

# Seed the database
echo "Seeding the database..."
if ./script/seed; then
    echo "Setup complete!"
else
    echo "Setup failed during database seeding"
    exit 1
fi