<?php

namespace Acms\Services\Installer;

use Acms\Services\SiteSeed\SiteSeedResult;

/**
 * Installer 実行結果 (不変 DTO)
 */
final class InstallerResult
{
    public function __construct(
        public readonly int $blogId,
        public readonly int $adminUserId,
        public readonly SiteSeedResult $seedResult,
        public readonly float $elapsedSec,
    ) {
    }

    /**
     * JSON 出力用の連想配列に変換
     *
     * @return array<string, mixed>
     */
    public function toArray(): array
    {
        return [
            'status' => 'ok',
            'blog_id' => $this->blogId,
            'admin_user_id' => $this->adminUserId,
            'elapsed_sec' => $this->elapsedSec,
            'seed_result' => $this->seedResult->toArray(),
        ];
    }
}
