<?php

declare(strict_types=1);

namespace App\Framework\Template\Processing;

use App\Framework\View\Dom\DocumentNode;
use App\Framework\View\RenderContext;

/**
 * AstTransformer - AST-based template transformation
 *
 * Modern replacement for DomProcessor that works with AST instead of DOM.
 * Provides better performance, reliability, and maintainability.
 *
 * Examples:
 * - XComponentTransformer: Transform <x-component> tags to rendered components
 * - ComponentTransformer: Process <component> includes
 * - ForTransformer: Handle <for> loops in AST
 * - LayoutTransformer: Apply layout templates
 * - AssetTransformer: Inject CSS/JS assets
 */
interface AstTransformer
{
    /**
     * Transform the AST document
     *
     * @param DocumentNode $document The AST to transform
     * @param RenderContext $context Rendering context with data and metadata
     * @return DocumentNode The transformed AST
     */
    public function transform(DocumentNode $document, RenderContext $context): DocumentNode;
}
