<?php
$file = 'app/Providers/Filament/AdminPanelProvider.php';
$content = file_get_contents($file);
if (strpos($content, '\\Saade\\FilamentFullCalendar\\FilamentFullCalendarPlugin::make()') === false) {
    if (strpos($content, "FilamentShieldPlugin::make()") !== false) {
        $content = str_replace(
            "FilamentShieldPlugin::make(),\n            ])",
            "FilamentShieldPlugin::make(),\n                \\Saade\\FilamentFullCalendar\\FilamentFullCalendarPlugin::make(),\n            ])",
            $content
        );
        // Try Windows CRLF
        $content = str_replace(
            "FilamentShieldPlugin::make(),\r\n            ])",
            "FilamentShieldPlugin::make(),\r\n                \\Saade\\FilamentFullCalendar\\FilamentFullCalendarPlugin::make(),\r\n            ])",
            $content
        );
        file_put_contents($file, $content);
        echo "File updated.\n";
    }
    else {
        echo "FilamentShieldPlugin::make() not found.\n";
    }
}
else {
    echo "Already registered.\n";
}
