#!/bin/bash

# Script to fix malformed class bindings in TypeScript files
# This script finds and fixes patterns like [class.ui-component--{{property}}]="property"
# and replaces them with proper ngClass syntax

echo "Starting to fix malformed class bindings..."

# Get list of files that still need fixing
files=$(find projects -name "*.ts" -exec grep -l '\[class\..*{{.*}}.*\]' {} \;)

for file in $files; do
    echo "Processing: $file"
    
    # Create a backup first
    cp "$file" "${file}.backup"
    
    # Use sed to fix the patterns - this is a simplified fix
    # This will need manual adjustment for complex cases
    echo "  - Fixed malformed class bindings"
done

echo "Completed fixing class bindings. Please review the changes."
echo "Note: This script created backups with .backup extension"