<?php

declare(strict_types=1);

namespace Activetwist\Jsonm;

/**
 * Per-target transpiler contract. A JSONM payload is universal; how it
 * materializes for a given consuming AT app is the transpiler target's
 * responsibility. Each AT product supplies (or selects) a target whose
 * output matches its runtime expectations: CSS variables with its own
 * prefix, design-tokens JSON, Tailwind config, etc.
 *
 * Implementations MUST validate the payload before emission and MUST
 * raise on validation errors.
 */
interface Transpiler
{
    /**
     * @param array<string, mixed> $definition  Validated JSONM payload.
     * @param array<string, mixed> $tokenMap    The cssVar ↔ jsonPath bridge (target-specific).
     * @param JsonmProfile         $profile     Consuming-app configuration.
     */
    public function transpile(array $definition, array $tokenMap, JsonmProfile $profile): string;

    /**
     * @param array<string, mixed> $definition
     */
    public function transpileFontRoles(array $definition, JsonmProfile $profile): string;
}
