<?php

/*
 * This file is part of the VITICORE2 package.
 *
 * (c) CP Creation <web@cpcreation.fr>
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */

namespace CpCreation\VitiCore\AgeVerification\Model;

/**
 * Conservative minimum age for unrestricted alcohol access.
 *
 * Explicit administration rules always take precedence. Countries with
 * beverage-specific or regional rules deliberately use the safest age here.
 */
enum CountryLegalAge: int
{
    public const string DATA_VERSION = '2026-07-22';

    case EIGHTEEN = 18;
    case TWENTY_ONE = 21;

    public static function forCountry(string $countryCode): ?self
    {
        return match (mb_strtoupper(mb_trim($countryCode))) {
            'BE', 'DE', 'ES', 'FR', 'GB', 'IT', 'NL' => self::EIGHTEEN,
            'US' => self::TWENTY_ONE,
            default => null,
        };
    }
}
