<?php

declare(strict_types=1);

namespace App\Http\Requests;

use App\Enums\GroupMemberRole;
use Illuminate\Foundation\Http\FormRequest;
use Illuminate\Validation\Rule;

class UpdateGroupMemberRequest extends FormRequest
{
    public function authorize(): bool
    {
        return $this->user()->can('update', $this->route('group'));
    }

    public function rules(): array
    {
        return [
            'role_in_group' => ['required', Rule::enum(GroupMemberRole::class)],
        ];
    }
}
