$patterns = @(
    @{
        'Old' = 'from "Components/'
        'New' = 'from "@/components/'
    },
    @{
        'Old' = 'from "Utils/'
        'New' = 'from "@/utils/'
    },
    @{
        'Old' = 'from "Context/'
        'New' = 'from "@/context/'
    },
    @{
        'Old' = 'from "Routes/'
        'New' = 'from "@/routes/'
    },
    @{
        'Old' = 'from "Pages/'
        'New' = 'from "@/pages/'
    },
    @{
        'Old' = 'from "Hooks/'
        'New' = 'from "@/hooks/'
    },
    @{
        'Old' = 'from "Assets/'
        'New' = 'from "@/assets/'
    },
    @{
        'Old' = 'from "Src/'
        'New' = 'from "@/src/'
    }
)

$srcPath = ".\src"
$files = Get-ChildItem -Path $srcPath -Recurse -Include "*.ts","*.tsx"

foreach ($file in $files) {
    $content = Get-Content $file.FullName -Raw
    $modified = $false
    
    foreach ($pattern in $patterns) {
        if ($content -match $pattern.Old) {
            $content = $content -replace $pattern.Old, $pattern.New
            $modified = $true
        }
    }
    
    if ($modified) {
        Write-Host "Updating imports in: $($file.FullName)"
        $content | Set-Content $file.FullName -NoNewline
    }
}
