<?php

declare(strict_types=1);

namespace App\Services\SupportCenter;

/**
 * 官方发布包交付前自检：防止缺失凭证、Stub 或错误 env 前缀进入发布流水线。
 */
final class SupportCenterReleasePackageCheckService
{
    public function __construct(
        private readonly SupportCenterLocalChecks $localChecks,
        private readonly SupportCenterRemoteProbe $remoteProbe,
    ) {}

    public function run(bool $includeRemote = false): SupportCenterCheckReport
    {
        $rows = $this->localChecks->coreRows(releasePackageMode: true);

        if ($includeRemote) {
            $rows[] = $this->remoteProbe->probeRow();
        }

        return new SupportCenterCheckReport($rows);
    }
}
