# =============================================================================
# RUSTELO FRAMEWORK - MODULAR JUSTFILE TEMPLATE
# =============================================================================
# Modern Rust Web Framework - Modular task runner configuration
#
# This justfile demonstrates the fallback import system that implementations can use:
#
# IMPLEMENTATION USAGE:
# Copy this pattern to your implementation's justfile and customize:
#
# mod? local-base 'justfiles/base.just'           # Local implementation version
# mod? base '../rustelo/justfiles/base.just'      # Framework fallback
# mod? local-content 'justfiles/content.just'     # Local implementation version
# mod? content '../rustelo/justfiles/content.just' # Framework fallback
#
# This creates a fallback system where implementations can override any framework
# module by creating their own local version, or use framework defaults.

# Set shell for commands
set shell := ["bash", "-c"]

project_root := justfile_directory()

# =============================================================================
# FRAMEWORK MODULE IMPORTS
# =============================================================================
# Framework uses direct imports since there's no fallback needed
# Implementations should use the mod? pattern shown above

import 'justfiles/base.just'
import 'justfiles/database.just'
import 'justfiles/quality.just'
import 'justfiles/docs.just'
import 'justfiles/content.just'
import 'justfiles/testing.just'
import 'justfiles/build.just'
import 'justfiles/assets.just'
import 'justfiles/aliases.just'
import 'justfiles/adr.just'

mod site 'justfiles/site.just'

# =============================================================================
# FRAMEWORK-SPECIFIC COMMANDS
# =============================================================================

# Default recipe to display help
default:
    @just --list

# =============================================================================
# FRAMEWORK SETUP COMMANDS
# =============================================================================

# Complete framework setup
# setup:
#     @echo "🔧 Setting up Rustelo framework..."
#     ./scripts/setup/setup_dev.sh

# Setup with custom name
setup-name name:
    @echo "🔧 Setting up Rustelo framework with name: {{name}}..."
    ./scripts/setup/setup_dev.sh --name {{name}}

# Setup for production
setup-prod:
    @echo "🔧 Setting up Rustelo framework for production..."
    ./scripts/setup/setup_dev.sh --env prod

# Install framework dependencies
setup-deps:
    @echo "🔧 Installing framework dependencies..."
    ./scripts/setup/install-dev.sh

# Setup wizard
setup-wizard:
    @echo "🔧 Setting up configuration wizard..."
    ./scripts/setup/run_wizard.sh

# =============================================================================
# FRAMEWORK WORKFLOW COMMANDS
# =============================================================================

# Complete development workflow
workflow-dev:
    @echo "🔄 Running framework development workflow..."
    @just setup-deps
    @just css-build
    @just check-strict
    @just test
    @just dev

# Complete production workflow
workflow-prod:
    @echo "🔄 Running framework production workflow..."
    @just check-all
    @just build-prod

# Pre-commit workflow
pre-commit:
    @echo "🔄 Running framework pre-commit workflow..."
    @just fix
    @just check-strict
    @just test

# CI/CD workflow
ci:
    @echo "🔄 Running framework CI workflow..."
    @just fmt-check
    @just check-strict
    @just test
    @just audit
    @just build-prod

# =============================================================================
# FRAMEWORK INFO COMMANDS
# =============================================================================

# Show framework information
info:
    @echo "ℹ️ Rustelo Framework Information:"
    @echo "  Rust version: $(rustc --version)"
    @echo "  Cargo version: $(cargo --version)"
    @echo "  Node.js version: $(node --version 2>/dev/null || echo 'N/A')"
    @echo "  Framework root: $(pwd)"

# Show comprehensive system overview
overview:
    @echo "🔍 Running Rustelo framework overview..."
    ./scripts/overview.sh

# Check system requirements
check-requirements:
    @echo "✅ Checking Rustelo framework requirements..."
    @echo "Rust: $(rustc --version 2>/dev/null || echo 'Not installed')"
    @echo "Cargo: $(cargo --version 2>/dev/null || echo 'Not installed')"
    @echo "Node.js: $(node --version 2>/dev/null || echo 'Not installed')"

# =============================================================================
# HELP COMMANDS
# =============================================================================

# Show main help
help:
    @echo ""
    @just logo
    @echo "🚀 Development         dev, build, test, clean"
    @echo "🔍 Quality            check-all, audit, fix"
    @echo "🗄️ Database           db-setup, db-migrate, db-status"
    @echo "📚 Documentation      docs-build, docs-serve, docs-api"
    @echo "📝 Content            content-build, content-generate, content-sync"
    @echo "🌐 Testing            page-tester, pages-report, test-all-pages"
    @echo "🎨 Build System       build-css-bundles, build-design-system, dist-pack"
    @echo ""
    @echo "🔧 Setup              setup, setup-deps, setup-wizard"
    @echo "🔄 Workflows          workflow-dev, pre-commit, ci"
    @echo "ℹ️  Information        info, overview, check-requirements"
    @echo ""
    @echo "📖 For all commands: just --list"
    @echo ""

# Show Rustelo logo
logo:
    @echo "  _ "
    @echo " |_)        _  _|_   _   |   _  "
    @echo " | \\  |_|  _>   |_  (/_  |  (_) "
    @echo " ______________________________"
    @echo "  FRAMEWORK"
