<?php

namespace App\Validator\Constraints;

use App\Model\UserGroupPermissions;
use Symfony\Component\Validator\Constraint;

#[\Attribute]
class UserGroupsValidPermission extends Constraint
{
    private array $roles;
    public string $message;

    public function __construct(mixed $options = null, ?array $groups = null, mixed $payload = null)
    {
        parent::__construct($options, $groups, $payload);

        $this->roles = UserGroupPermissions::getRoles();
        $this->message = sprintf(
            'The permission is not valid. Please use one of the following: %s',
            implode(', ', $this->roles)
        );
    }


}