<?php

namespace App\Filament\Resources\TeacherResource\Pages;
use Illuminate\Database\Eloquent\Builder;

use App\Filament\Resources\TeacherResource;
use Filament\Resources\Pages\EditRecord;

class EditTeacher extends EditRecord
{
    protected static string $resource = TeacherResource::class;
    protected string $view = 'filament.resources.teacher.pages.edit-teacher';

    protected function getRedirectUrl(): string
    {
        return $this->getResource()::getUrl('view', ['record' => $this->record]);
    }

    protected function getSavedNotificationTitle(): ?string
    {
        return '教师信息已更新';
    }

    protected function getSavedNotification(): ?\Filament\Notifications\Notification
    {
        return \Filament\Notifications\Notification::make()
            ->success()
            ->title('教师信息已更新')
            ->body('教师信息已成功更新。');
    }

    public function getTitle(): string
    {
        return '编辑教师 - ' . $this->record->name;
    }

    public function getBreadcrumbs(): array
    {
        return [];
    }

    protected function getHeaderActions(): array
    {
        return [];
    }

    protected function getFormActions(): array
    {
        return [
            $this->getSaveFormAction()
                ->label('保存'),
            $this->getCancelFormAction()
                ->label('取消'),
        ];
    }
}
