<?php
declare(strict_types=1);

namespace PpPhp\Core\Platform\Modules;

use PpPhp\Core\Platform\Manifest\ManifestRecord;

final class ModuleRecord
{
    public function __construct(
        private readonly ManifestRecord $manifest
    ) {}

    public function id(): string { return $this->manifest->id(); }
    public function label(): string { return $this->manifest->label(); }
    public function version(): string { return $this->manifest->version(); }
    public function status(): string { return $this->manifest->status(); }
    public function enabled(): bool { return $this->manifest->enabled(); }
    public function manifest(): ManifestRecord { return $this->manifest; }

    public function toArray(): array
    {
        return [
            'id' => $this->id(),
            'label' => $this->label(),
            'version' => $this->version(),
            'status' => $this->status(),
            'enabled' => $this->enabled(),
            'manifest' => $this->manifest->toArray(),
        ];
    }
}
