<?php

declare(strict_types=1);

namespace Plugin\tnt_mcp\src\Mcp\Action;

/**
 * The shop file and the literal snippet that prove a catalog entry describes the controller as it
 * is actually written. The smoke test asserts every one of these, so a JTL release that renames a
 * `$_POST` key breaks the build instead of breaking an invocation in production.
 *
 * Build-time only: never returned to the LLM.
 */
final class EvidenceRef
{
    private function __construct(
        public readonly string $file,
        public readonly string $contains,
    ) {
    }

    /**
     * @param array<mixed> $raw
     */
    public static function fromArray(array $raw): self
    {
        return new self(
            \is_string($raw['file'] ?? null) ? $raw['file'] : '',
            \is_string($raw['contains'] ?? null) ? $raw['contains'] : '',
        );
    }
}
