<?php

declare(strict_types=1);

namespace MyCustomizer\WooCommerce\Connector\Libs\Admin;

use ReflectionClass;

class MczrMessageType
{
    const SUCCESS = 'success';
    const INFO = 'info';
    const ERROR = 'error';
    const WARNING = 'warning';

    private static function getAll(): array
    {
        static $types = null;

        if ($types === null) {
            $reflection = new ReflectionClass(__CLASS__);
            $types = array_values($reflection->getConstants());
        }

        return $types;
    }

    public static function isValid(string $type): bool
    {
        return in_array($type, self::getAll(), true);
    }
}
