<?php

declare(strict_types=1);

namespace App\Services\SupportCenter;

/**
 * 系统更新子步骤执行方式（进程内 / 子进程 / 先内后外回退）。
 */
final class HostSystemUpdateHandlerMode
{
    public const IN_PROCESS = 'in_process';

    public const PROCESS = 'process';

    public const FALLBACK = 'fallback';

    public static function normalize(?string $value, string $default = self::IN_PROCESS): string
    {
        $normalized = strtolower(trim((string) $value));

        return match ($normalized) {
            self::PROCESS, self::FALLBACK => $normalized,
            default => $default,
        };
    }
}
