<?php

declare(strict_types=1);

/**
 * APO-193 Card 9 — Get the current default footer.
 *
 * URI:   GET /api/v1/design/footers/default
 * Scope: design.read
 */
final class MyronGetFooterDefaultAction implements MyronAction
{
    public function __construct(
        private readonly MyronFooterDesignRepository $footers,
    ) {
    }

    public function metadata(): MyronActionMetadata
    {
        return new MyronActionMetadata(
            uri:           '/api/v1/design/footers/default',
            method:        'GET',
            domain:        'design',
            resource:      'footer-default',
            verb:          'get',
            inputSchema:   ['type' => 'object', 'properties' => []],
            outputSchema:  ['type' => 'object', 'properties' => []],
            requiredScope:   MyronApiScopes::DESIGN_READ,
            summary:         'Get the current global default footer variant. Response includes both `variant_id` (machine code) and `variant_label` (human-readable name).',
            sideEffects:     [],
            preconditions:   [],
            postconditions:  [],
            audienceClass:   3,
            adminAliases:    [],
            snapshotInclude: true,
            snapshotKey:     'design.footerDefault',
            exposeToMcp:     true,
        );
    }

    public function execute(array $input, MyronActionCallerContext $caller): MyronActionResult
    {
        return MyronActionResult::ok((array) $this->footers->getDefault());
    }
}
