<?php

namespace App\Modules\Sales\Requests;

use App\Modules\Sales\Models\SalesOrder;
use Illuminate\Foundation\Http\FormRequest;

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

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