<?php

namespace App\Http\Requests\Admin;

use App\Http\Requests\ApiFormRequest;

/**
 * 管理员用户权限同步请求。
 *
 * @see AdminUserPermissionSyncController
 */
final class AdminUserPermissionSyncRequest extends ApiFormRequest
{
    public function authorize(): bool
    {
        return true;
    }

    /**
     * @return array<string, array<int, mixed>>
     */
    public function rules(): array
    {
        return [
            'permissions' => ['sometimes', 'array'],
            'permissions.*' => ['string', 'max:128'],
            'permission_slugs' => ['sometimes', 'array'],
            'permission_slugs.*' => ['string', 'max:128'],
        ];
    }
}
