<?php
declare(strict_types=1);

namespace PpPhp\Core\Platform\DI\Metadata;

final class Lifetime
{
    public const SINGLETON = 'singleton';
    public const SCOPED = 'scoped';
    public const PROTOTYPE = 'prototype';
    public const TRANSIENT = 'transient';
    public const INSTANCE = 'instance';
    public const FACTORY = 'factory';
    public const VALUE = 'value';
    public const ALIAS = 'alias';

    public static function all(): array
    {
        return [self::SINGLETON, self::SCOPED, self::PROTOTYPE, self::TRANSIENT, self::INSTANCE, self::FACTORY, self::VALUE, self::ALIAS];
    }

    public static function valid(string $lifetime): bool
    {
        return in_array($lifetime, self::all(), true);
    }
}
