# Script to replace HugeIcon references with Icons

$replacements = @{
    'HugeIcon\(' = 'Icon('
    'HugeIcons\.([a-zA-Z0-9_]+)' = 'Icons.$1'
    'HugeIconsStrokeRounded\.([a-zA-Z0-9_]+)' = 'Icons.$1'
    'HugeIcons icon' = 'IconData icon'
    'HugeIcons\?' = 'IconData?'
}

$iconMappings = @{
    'arrowLeft' = 'arrow_back'
    'image' = 'image_outlined'
    'settings01' = 'settings_outlined'
    'user' = 'person_outline'
    'heart' = 'favorite_border'
    'bookmark' = 'bookmark_border'
    'cornerDownRight' = 'subdirectory_arrow_right'
}

$files = @(
    "lib\screens\profile\profile_screen.dart",
    "lib\screens\compose\compose_screen.dart",
    "lib\screens\post\post_detail_screen.dart"
)

foreach ($file in $files) {
    if (Test-Path $file) {
        $content = Get-Content $file -Raw
        
        # Apply replacements
        foreach ($pattern in $replacements.Keys) {
            $replacement = $replacements[$pattern]
            $content = $content -replace $pattern, $replacement
        }
        
        # Apply icon name mappings
        foreach ($oldName in $iconMappings.Keys) {
            $newName = $iconMappings[$oldName]
            $content = $content -replace "Icons\.$oldName", "Icons.$newName"
        }
        
        # Save the file
        $content | Set-Content $file -NoNewline
        Write-Host "Fixed: $file"
    }
}

Write-Host "`nDone! All HugeIcon references should now be replaced with Icons."
