<?php

namespace App\Modules\Procurement\Requests;

use App\Modules\Procurement\Models\GoodsReceipt;
use Illuminate\Foundation\Http\FormRequest;

class BulkValidateGoodsReceiptsRequest extends FormRequest
{
    public function authorize(): bool
    {
        return $this->user() !== null && $this->user()->can('viewAny', GoodsReceipt::class);
    }

    /**
     * @return array<string, mixed>
     */
    public function rules(): array
    {
        return [
            'ids' => ['required', 'array', 'min:1', 'max:50'],
            'ids.*' => ['integer', 'distinct'],
            'confirmation' => ['required', 'string', 'in:VALIDATE_GR'],
        ];
    }
}
