<?php

namespace App\Validator\Constraints;

use App\Model\OrganizationalUnitMulticastModes;
use App\Model\OrganizationalUnitP2PModes;
use App\Model\UserGroupPermissions;
use Symfony\Component\Validator\Constraint;
use Symfony\Component\Validator\ConstraintValidator;

class OrganizationalUnitMulticastModeValidator extends ConstraintValidator
{
    public function validate($value, Constraint $constraint): void
    {
        if (null === $value) {
            return;
        }

        if (!in_array($value, OrganizationalUnitMulticastModes::getMcastModes())) {
            $this->context->buildViolation($constraint->message)->addViolation();
        }
    }
}