<?php

declare(strict_types=1);

namespace App\Services\SupportCenter;

use App\Enums\SupportCenter\HostSystemUpdateStepPhase;
use App\Models\HostSystemUpdateExecution;

/**
 * 单次 run-next-step 结果。
 */
final readonly class HostSystemUpdateStepResult
{
    public function __construct(
        public string $sessionId,
        public HostSystemUpdateStepPhase $phase,
        public bool $terminal,
        public bool $failed,
        public ?HostSystemUpdateExecution $execution,
        public ?string $userMessage,
        public ?HostSystemUpdateMigrationProgress $migrationProgress,
        public ?HostSystemUpdateBatchProgress $batchProgress = null,
    ) {}

    public function shouldContinuePolling(): bool
    {
        return ! $this->terminal && ! $this->failed;
    }
}
