#!/bin/bash

echo "🏥 Building Albi Health Tracker - Release"
echo "========================================"

cd "$(dirname "$0")"

echo "🧹 Cleaning..."
flutter clean
flutter pub get

echo "🔨 Building release APK..."
flutter build apk --release

if [ $? -eq 0 ]; then
    echo "✅ Build successful!"
    echo "📱 APK: build/app/outputs/flutter-apk/app-release.apk"
    echo "📊 Size: $(du -h build/app/outputs/flutter-apk/app-release.apk | cut -f1)"
else
    echo "❌ Build failed!"
    exit 1
fi