<?php

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

use App\Filament\Resources\OCRRecordResource;
use Filament\Resources\Pages\CreateRecord;

class CreateOCRRecord extends CreateRecord
{
    protected static string $resource = OCRRecordResource::class;

    public function getTitle(): string
    {
        return '上传考试卷子';
    }

    public function getHeading(): string
    {
        return '上传考试卷子';
    }

    protected function mutateFormDataBeforeCreate(array $data): array
    {
        if (isset($data['file_path'])) {
            // 文件路径会自动处理，不需要额外设置 paper_title
        }

        return $data;
    }

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

    protected function getCreatedNotificationTitle(): ?string
    {
        return '卷子上传成功，等待OCR处理';
    }
}
