#!/bin/bash

# setup_brick.sh
echo "🧹 Cleaning old Mason cache (Hard Refresh)..."
rm -rf .mason

echo "📦 Fetching Hook dependencies (Yaml/Mason)..."
if [ -d "bricks/api_endpoint/hooks" ]; then
    cd bricks/api_endpoint/hooks
    dart pub get
    cd ../../../
else
    echo "❌ Error: Hooks directory not found!"
    exit 1
fi

echo "🧱 Getting latest Brick definition..."
mason get

echo "✅ Ready! Run 'mason make api_endpoint'"