<?php

namespace App\Filament\Resources\AlertMailRuleResource\Pages;

use App\Filament\Resources\AlertMailRuleResource;
use Filament\Actions;
use Filament\Resources\Pages\CreateRecord;

class CreateAlertMailRule extends CreateRecord
{
    protected static string $resource = AlertMailRuleResource::class;

     protected function mutateFormDataBeforeCreate(array $data): array
    {
        if ($data['is_active']) {
            $data['plant'] = 0;
        }

        return $data;
    }

    protected function getRedirectUrl(): string
    {
        return $this->getResource()::getUrl('create');
    }
}
