<?php

declare(strict_types=1);

namespace PpPhp\Core\Platform\Services\Blueprint;

use PpPhp\Core\Platform\Foundation\AbstractPlatformObject;
use PpPhp\Core\Platform\Foundation\PlatformIdentity;
use PpPhp\Core\Platform\Foundation\PlatformMetadata;
use PpPhp\Core\Platform\Foundation\PlatformVersion;

final class ServiceBlueprint extends AbstractPlatformObject implements BlueprintInterface
{
    public function __construct(
        PlatformIdentity $identity,
        PlatformVersion $version,
        PlatformMetadata $metadata = new PlatformMetadata(),
        private readonly array $dependencies = [],
        private readonly array $capabilities = [],
        private readonly string $lifecycle = 'singleton',
        private readonly string $visibility = 'public',
        private readonly array $runtimePolicy = [],
        private readonly array $validation = []
    ) {
        parent::__construct($identity, $version, $metadata);
    }

    public function dependencies(): array
    {
        return $this->dependencies;
    }

    public function capabilities(): array
    {
        return $this->capabilities;
    }

    public function lifecycle(): string
    {
        return $this->lifecycle;
    }

    public function visibility(): string
    {
        return $this->visibility;
    }

    public function runtimePolicy(): array
    {
        return $this->runtimePolicy;
    }

    public function validation(): array
    {
        return $this->validation;
    }

    public function toArray(): array
    {
        return array_merge(parent::toArray(), [
            'dependencies' => $this->dependencies,
            'capabilities' => $this->capabilities,
            'lifecycle' => $this->lifecycle,
            'visibility' => $this->visibility,
            'runtimePolicy' => $this->runtimePolicy,
            'validation' => $this->validation,
        ]);
    }
}
