<?php

namespace App\Master\Http\Requests;

use JetBrains\PhpStorm\ArrayShape;
use Stancl\Tenancy\Database\Concerns\CentralConnection;

class UpdateUserRoleOnSiteRequest extends SiteRequest
{
    use CentralConnection;

    /**
     * Get the validation rules that apply to the request.
     *
     * @return array
     */
    #[ArrayShape(['userId' => "string[]", 'role' => "string[]"])]
    #[\Override] public function rules()
    {
        $global = $this->getConnectionName();
        return [
            'userId' => [
                'required',
                "exists:$global.users,id",
            ],
            'role' => [
                'required',
            ]
        ];
    }
}
