<?php

declare(strict_types=1);

/** APO-194 Card 7 — GET /api/v1/design/navigation/versions */
final class MyronListNavigationVersionsAction implements MyronAction
{
    public function __construct(private readonly MyronNavigationDesignRepository $repo) {}

    public function metadata(): MyronActionMetadata
    {
        return new MyronActionMetadata(
            uri: '/api/v1/design/navigation/versions', method: 'GET',
            domain: 'design', resource: 'navigation-version', verb: 'list',
            inputSchema: ['type' => 'object', 'properties' => []],
            outputSchema: ['type' => 'object', 'properties' => ['items' => ['type' => 'array']]],
            requiredScope: MyronApiScopes::DESIGN_READ,
            summary: 'List saved navigation versions with activation, default, and settings state.',
            audienceClass: 3,
            snapshotInclude: true, snapshotKey: 'design.navigationVersions',
            exposeToMcp: true,
        );
    }

    public function execute(array $input, MyronActionCallerContext $caller): MyronActionResult
    {
        return MyronActionResult::ok(['items' => $this->repo->listVersions()]);
    }
}
