"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.generateAppSchemaV4 = generateAppSchemaV4;
/**
 * Generates an app-specific schema from the generic schema.
 * Generic types are replaced by data from the app-specific annotations.
 *
 * @param {GenerateAppSchemaParameters} generateParameters - list of API input parameters
 * @param {object} appSchema - generic JSON schema of the application page (app.json)
 */
function generateAppSchemaV4(generateParameters, appSchema) {
    const settingDefinition = appSchema.definitions?.AppSettings;
    const sideEffectsEventsInteractionType = settingDefinition.properties
        ?.sideEffectsEventsInteractionType;
    // Hide settings that are defined in schema, but required annotation is missing
    const entityTypes = generateParameters.serviceAVT?.entityTypes ?? [];
    const hasSideEffectsEvents = entityTypes.find((entityType) => {
        const common = entityType.annotations.Common ?? {};
        for (const term in common) {
            // Check for side effects with or withour qualifiers
            if (term.startsWith('SideEffects')) {
                const sourceEvents = common?.[term]?.SourceEvents;
                return sourceEvents !== undefined && sourceEvents.length > 0;
            }
        }
    });
    if (!hasSideEffectsEvents) {
        sideEffectsEventsInteractionType.hidden = true;
    }
}
//# sourceMappingURL=app.js.map