<?php

declare(strict_types=1);

namespace PpPhp\Core\Build;

/**
 * The wire contract shared by {@see BuildClient} (customer side) and the build
 * authority ({@see \PpPhp\Modules\Projects\Controllers\BuildApiController}).
 *
 * This is the ONLY build-related file that ships to a client alongside BuildClient
 * — it carries constants, never generation logic. The generator itself
 * (BuildWriter, ComponentRenderer, BuildEngine) stays on the authority.
 */
final class BuildProtocol
{
    /** Ed25519 token prefix for a signed build reply (distinct from PPT1/PPU1). */
    public const PREFIX = 'PPB1';

    /** The authority endpoint a client posts a design to. */
    public const ROUTE_GENERATE = '/api/build/generate';

    /**
     * The `ModuleState` modules that together ARE a project's design — the input
     * a build consumes. Kept in one place so client and server never disagree
     * about what travels. (Matches what BuildEngine::build() loads.)
     *
     * @var list<string>
     */
    public const DESIGN_MODULES = [
        'tables', 'fields', 'output', 'misc', 'events', 'designer',
        'pages', 'security', 'query', 'calendar', 'notifRules', 'themes',
    ];

    /** Hard ceiling on a returned build payload (base64-inflated) — a safety rail. */
    public const MAX_BUILD_BYTES = 48 * 1024 * 1024;
}
