<?php

namespace App\Filament\Resources\Publication\News\Pages;

use App\Filament\Actions\BackAction;
use App\Filament\Resources\Publication\News\NewsResource;
use App\Filament\Support\CheerfulNotification;
use Filament\Notifications\Notification;
use Filament\Resources\Pages\CreateRecord;

class CreateNews extends CreateRecord
{
    protected static string $resource = NewsResource::class;

    protected static ?string $title = 'Tambah Berita';

    protected function getHeaderActions(): array
    {
        return [
            BackAction::make()
                ->url(ListNews::getUrl()),
        ];
    }

    protected function getCreatedNotification(): ?Notification
    {
        return CheerfulNotification::create();
    }

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