<?php

namespace App\Http\Requests\Roles;

use App\Http\Requests\ApiFormRequest;

class RolePermissionUpdateRequest extends ApiFormRequest
{
    public function authorize(): bool
    {
        return auth()->check();
    }

    public function rules(): array
    {
        return [
            'permissions' => ['required', 'array'],
            'permissions.*' => ['array'],
            'permissions.*.create' => ['nullable', 'boolean'],
            'permissions.*.read' => ['nullable', 'boolean'],
            'permissions.*.update' => ['nullable', 'boolean'],
            'permissions.*.delete' => ['nullable', 'boolean'],
            'permissions.*.manage' => ['nullable', 'boolean'],
        ];
    }
}
