/**
 * export.ts — Full export pipeline: WorldProject → ContentPack + GameManifest + PackMetadata
 *
 * ## Export Pipeline Architecture
 *
 * The export pipeline converts a {@link WorldProject} into engine-compatible artifacts:
 *
 * 1. **Validation** — The project is validated via `validateProject`. Invalid projects
 *    produce an {@link ExportError} and halt the pipeline.
 *
 * 2. **Per-domain conversion** — Each domain is converted by a dedicated converter:
 *    - `convertZones` → engine `ZoneDefinition[]`
 *    - `convertDistricts` → engine `DistrictDefinition[]`
 *    - `convertEntities` → engine `EntityBlueprint[]`
 *    - `convertItems` → engine `ItemDefinition[]`
 *    - `convertDialogues` → engine `DialogueDefinition[]`
 *    - `convertPlayerTemplate` → engine player template
 *    - `convertBuildCatalog` → engine build catalog
 *    - `convertProgressionTrees` → engine progression trees
 *
 * 3. **Manifest + metadata** — `convertManifest` and `convertPackMeta` produce the
 *    engine's `GameManifest` and `PackMetadata` from project-level fields.
 *
 * 4. **Asset binding collection** — Asset references (backgrounds, sprites, icons)
 *    are collected into an {@link AssetBindingMap} for round-trip preservation.
 *
 * 5. **Result assembly** — All pieces are combined into an {@link ExportResult}.
 *
 * ## How to Add a Custom Export Target
 *
 * 1. Create a new converter module (e.g. `convert-my-target.ts`) that accepts a
 *    {@link WorldProject} and returns your target format.
 * 2. If your target needs the full pipeline output, write a wrapper around
 *    {@link exportToEngine} that post-processes the {@link ExportResult}.
 * 3. If your target needs a completely different pipeline, write a new top-level
 *    export function following the same validate → convert → assemble pattern.
 * 4. Re-export your new function/types from `index.ts`.
 *
 * @module export
 */
import type { WorldProject, ValidationError, AssetEntry, AssetPack, EncounterAnchor, FactionPresence, PressureHotspot } from '@world-forge/schema';
import type { ZoneDefinition, EntityBlueprint, DialogueDefinition, ProgressionTreeDefinition } from '@ai-rpg-engine/content-schema';
import type { GameManifest } from '@ai-rpg-engine/core';
import type { DistrictDefinition } from '@ai-rpg-engine/modules';
import type { PackMetadata } from '@ai-rpg-engine/pack-registry';
import type { ItemDefinition } from '@ai-rpg-engine/equipment';
import { type ExportedPlayerTemplate } from './convert-player-template.js';
import { type ExportedBuildCatalog } from './convert-build-catalog.js';
import { type FidelityReport } from './fidelity.js';
/**
 * Export profile controls how much diagnostic metadata is emitted.
 *
 * - `'release'` (default) — minimal, stable, deterministic output suitable for
 *   shipping. No `_debug` block. Fidelity entries are emitted normally.
 * - `'debug'` — adds a top-level `_debug` block (timestamp, schemaVersion,
 *   sourceProjectId, fidelityVerbose: true) to the ContentPack and instructs
 *   downstream consumers to preserve every fidelity entry (no level filtering).
 *   Still deterministic for a fixed project + fixed timestamp.
 */
export type ExportProfile = 'debug' | 'release';
/** Optional settings for {@link exportToEngine}. */
export interface ExportOptions {
    /** Export profile — `'release'` by default. */
    profile?: ExportProfile;
    /**
     * Override the timestamp used in the debug block. Only consulted when
     * `profile === 'debug'`. Defaults to `new Date().toISOString()`. Tests and
     * reproducible pipelines can pin this to get byte-identical output across
     * runs.
     */
    debugTimestamp?: string;
    /**
     * Include `schemaVersion` in the ContentPack (AIR-FT-005). Defaults to
     * `true`. When `true`, the version is pulled from `@world-forge/schema`'s
     * `package.json`.
     */
    emitSchemaVersion?: boolean;
}
/**
 * Debug metadata block injected at the top of the ContentPack when
 * `profile === 'debug'`.
 *
 * Field ordering here (timestamp → schemaVersion → sourceProjectId →
 * fidelityVerbose) is stable across runs — JSON.stringify preserves object
 * insertion order, so identical inputs produce byte-identical output.
 */
export interface ExportDebugBlock {
    timestamp: string;
    schemaVersion: string;
    sourceProjectId: string;
    fidelityVerbose: true;
}
export type ContentPack = {
    /** Debug metadata — present only when exported with `profile: 'debug'`. */
    _debug?: ExportDebugBlock;
    /** Schema version pulled from `@world-forge/schema`. Omitted when `emitSchemaVersion: false`. */
    schemaVersion?: string;
    entities: EntityBlueprint[];
    zones: ZoneDefinition[];
    districts: DistrictDefinition[];
    dialogues: DialogueDefinition[];
    items: ItemDefinition[];
    playerTemplate?: ExportedPlayerTemplate;
    buildCatalog?: ExportedBuildCatalog;
    progressionTrees: ProgressionTreeDefinition[];
    encounterAnchors: EncounterAnchor[];
    factionPresences: FactionPresence[];
    pressureHotspots: PressureHotspot[];
};
export type AssetBindingMap = {
    zones?: Record<string, {
        backgroundId?: string;
        tilesetId?: string;
    }>;
    entities?: Record<string, {
        portraitId?: string;
        spriteId?: string;
    }>;
    items?: Record<string, {
        iconId?: string;
    }>;
    landmarks?: Record<string, {
        iconId?: string;
    }>;
};
export type ExportResult = {
    success: true;
    contentPack: ContentPack;
    manifest: GameManifest;
    packMeta: PackMetadata;
    warnings: string[];
    fidelity: FidelityReport;
    assets?: AssetEntry[];
    assetBindings?: AssetBindingMap;
    assetPacks?: AssetPack[];
};
export type ExportError = {
    success: false;
    errors: ValidationError[];
};
/**
 * Export a WorldProject to engine-compatible ContentPack, GameManifest, and PackMetadata.
 *
 * @param project The authored world.
 * @param options Optional export settings. Backward compatible — omitting
 *   `options` behaves identically to pre-AIR-FT-001 callers.
 */
export declare function exportToEngine(project: WorldProject, options?: ExportOptions): ExportResult | ExportError;
//# sourceMappingURL=export.d.ts.map