# Build script for local development
#!/bin/bash

set -e

echo "🏗️  Building Homework Backend..."

# Clean previous builds
echo "🧹 Cleaning previous builds..."
dotnet clean

# Restore dependencies
echo "📦 Restoring dependencies..."
dotnet restore

# Build the application
echo "🔨 Building application..."
dotnet build --configuration Release --no-restore

# Run tests
echo "🧪 Running tests..."
dotnet test --configuration Release --no-build --verbosity normal

# Publish the application
echo "📤 Publishing application..."
dotnet publish Homework/Homework.csproj --configuration Release --output ./publish --no-build

echo "✅ Build completed successfully!"
echo "📁 Published files are in ./publish directory"