#!/bin/bash

# Build script for Health Tracker Free Version
# This builds an APK with all premium features hidden

echo "🏥 Building Health Tracker - Free Version"
echo "=========================================="

# Ensure we're in the right directory
cd "$(dirname "$0")"

# Clean previous builds
echo "🧹 Cleaning previous builds..."
flutter clean
flutter pub get

# Build the APK
echo "🔨 Building APK..."
flutter build apk --release --no-tree-shake-icons

# Check if build was successful
if [ $? -eq 0 ]; then
    echo "✅ Build successful!"
    echo "📱 APK location: build/app/outputs/flutter-apk/app-release.apk"
    echo ""
    echo "📋 Free Version Features:"
    echo "  ✅ Weight tracking"
    echo "  ✅ Blood pressure tracking" 
    echo "  ✅ Mood tracking"
    echo "  ✅ Basic charts and statistics"
    echo "  ✅ Local data export/import"
    echo "  ✅ Light/dark theme"
    echo ""
    echo "🚫 Hidden Premium Features:"
    echo "  ❌ Cloud backup"
    echo "  ❌ Local encryption"
    echo "  ❌ Advanced charts"
    echo "  ❌ Data correlation analysis"
    echo "  ❌ Premium upgrade prompts"
    echo ""
    echo "🎯 Ready for distribution!"
else
    echo "❌ Build failed!"
    exit 1
fi
