<?php

namespace App\Http\Requests\Admin;

use App\Http\Requests\ApiFormRequest;

/**
 * 管理员用户角色同步请求。
 *
 * @see AdminUserRoleSyncController
 */
final class AdminUserRoleSyncRequest extends ApiFormRequest
{
    public function authorize(): bool
    {
        return true;
    }

    /**
     * @return array<string, array<int, mixed>>
     */
    public function rules(): array
    {
        return [
            'admin_site_id' => ['required', 'integer', 'exists:admin_sites,id'],
            'role_slugs' => ['required', 'array', 'min:1'],
            'role_slugs.*' => ['string', 'max:64', 'distinct', 'exists:admin_roles,slug'],
        ];
    }
}
