<?php

namespace App\Http\Requests;

use Illuminate\Foundation\Http\FormRequest;

class StockMutationRequest extends FormRequest
{
    public function authorize(): bool
    {
        return true;
    }

    public function rules(): array
    {
        return [
            'per_page' => ['nullable', 'integer', 'min:1', 'max:100'],
        ];
    }

    public function validatedWithDefaults(): array
    {
        $validated = $this->validated();

        return [
            'perPage' => $validated['per_page'] ?? 20,
        ];
    }
}
