<?php

declare(strict_types=1);

namespace App\Filament\Resources\DberpInventorySerialNumbers\Pages;

use App\Filament\Resources\DberpInventorySerialNumbers\DberpInventorySerialNumberResource;
use App\Filament\Resources\Pages\CreateRecord;
use Illuminate\Database\Eloquent\Model;
use Symfony\Component\HttpKernel\Exception\HttpException;

class CreateDberpInventorySerialNumber extends CreateRecord
{
    protected static string $resource = DberpInventorySerialNumberResource::class;

    public function mount(): void
    {
        abort(403, (string) __('dberp.hints.inventory_serial_number_manual_maintenance_blocked'));
    }

    protected function handleRecordCreation(array $data): Model
    {
        throw new HttpException(403, (string) __('dberp.hints.inventory_serial_number_manual_maintenance_blocked'));
    }
}
