# Justfile for Go Project Management

# List all available recipes
default:
    @just --list

# --- Backend ---

# Build the API server
build-api:
    go build -o bin/api ./cmd/api

# Run the API server locally
run-api:
    go run ./cmd/api/main.go

# Start the API and Database using Docker Compose
docker-up:
    docker-compose up --build -d

# Stop Docker Compose services
docker-down:
    docker-compose down

# Run all tests
test:
    go test ./...

# Run tests with verbose output
test-v:
    go test -v ./...

# Clean build artifacts
clean:
    rm -rf bin/

# --- TUI ---

# Build the Terminal UI
build-tui:
    go build -o bin/tui ./cmd/tui

# Run the Terminal UI
run-tui:
    go run ./cmd/tui/main.go

# --- GUI ---

# Build the GUI (Raylib)
build-gui:
    go build -o bin/gui ./cmd/gui

# Run the GUI
run-gui:
    go run ./cmd/gui/main.go

# --- Database ---

# Generate Go code from SQL (requires sqlc)
sqlc:
    sqlc generate

# Connect to the running database via psql
db-shell:
    docker-compose exec db psql -U postgres -d gamedb
