<?php

namespace App\Http\Requests\Admin;

use App\Http\Requests\ApiFormRequest;

final class AgentDelegationGrantSyncRequest extends ApiFormRequest
{
    public function authorize(): bool
    {
        return $this->lotteryAdmin() !== null;
    }

    /**
     * @return array<string, mixed>
     */
    public function rules(): array
    {
        return [
            'grants' => ['required', 'array'],
            'grants.*.menu_action_id' => ['required', 'integer', 'min:1'],
            'grants.*.can_delegate' => ['sometimes', 'boolean'],
        ];
    }
}
