// import-items.ts — engine ItemDefinition[] → schema ItemPlacement[]
export function importItems(engineItems, zoneIds) {
    const warnings = [];
    const fidelity = [];
    // EB-014: Early return with empty result when no items to import
    if (engineItems.length === 0) {
        return { placements: [], warnings, fidelity };
    }
    const defaultZone = zoneIds.length > 0 ? zoneIds[0] : 'unplaced';
    if (engineItems.length > 0) {
        warnings.push(`All ${engineItems.length} item(s) placed in zone '${defaultZone}' (original zones unknown)`);
    }
    const placements = engineItems.map((ei) => {
        const flags = ei.provenance?.flags;
        const hidden = Array.isArray(flags) && flags.includes('contraband');
        fidelity.push({
            level: 'approximated', domain: 'items', severity: 'warning',
            entityId: ei.id, fieldPath: 'zoneId',
            message: `Item '${ei.name}' placed in first zone '${defaultZone}' (original zone unknown)`,
            reason: 'zone-placement-first-zone',
        });
        if (hidden) {
            fidelity.push({
                level: 'approximated', domain: 'items', severity: 'info',
                entityId: ei.id, fieldPath: 'hidden',
                message: `Item '${ei.name}' hidden flag derived from contraband provenance`,
                reason: 'hidden-from-contraband',
            });
        }
        const item = {
            itemId: ei.id,
            name: ei.name,
            description: ei.description,
            zoneId: defaultZone,
            hidden,
            slot: ei.slot,
            rarity: ei.rarity,
        };
        if (ei.statModifiers && Object.keys(ei.statModifiers).length > 0) {
            item.statModifiers = { ...ei.statModifiers };
        }
        if (ei.resourceModifiers && Object.keys(ei.resourceModifiers).length > 0) {
            item.resourceModifiers = { ...ei.resourceModifiers };
        }
        if (ei.grantedTags && ei.grantedTags.length > 0) {
            item.grantedTags = [...ei.grantedTags];
        }
        if (ei.grantedVerbs && ei.grantedVerbs.length > 0) {
            item.grantedVerbs = [...ei.grantedVerbs];
        }
        return item;
    });
    return { placements, warnings, fidelity };
}
//# sourceMappingURL=import-items.js.map