<?php

namespace Formatrica\Fields;

if ( ! defined( 'ABSPATH' ) ) {
	exit;
}

/**
 * A frontend renderer for a single field type.
 *
 * Edition boundary (docs/wporg-free-runtime-separation.md §6.3): Free field
 * types are rendered inline by Form_Renderer. Field types whose capability is
 * paid implement this interface and live under app/Pro/Fields, registered into
 * the Field_Renderer_Registry by the Pro package. In a Free package no Pro
 * renderer is registered, so Form_Renderer falls back to '' for those types —
 * it never renders a Pro field and never substitutes a text input (which could
 * expose data or change submission semantics).
 */
interface Field_Renderer_Interface
{
    /** The field type string this renderer handles (e.g. "rating"). */
    public function type(): string;

    /**
     * @param array<string, mixed> $field
     */
    public function render(array $field, Field_Render_Context $context): string;
}
