"use strict";
/*!
 * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
 * Licensed under the MIT License.
 */
Object.defineProperty(exports, "__esModule", { value: true });
exports.getSimpleFieldSchema = void 0;
const schemaTypes_js_1 = require("./schemaTypes.js");
/**
 * A symbol for storing {@link FieldSchema}s on a {@link FlexFieldSchema}.
 */
const simpleFieldSchemaSymbol = Symbol(`simpleFieldSchema`);
/**
 * Gets the {@link FieldSchema} which corresponds with the provided {@link FlexFieldSchema | flexSchema}.
 * Caches the result on the provided `flexSchema` for future access.
 * @param flexSchema - The flex schema on which the result will be cached.
 * @param implicitSimpleSchema - The allowed types from which the `FieldSchema` will be derived.
 */
function getSimpleFieldSchema(flexSchema, implicitSimpleSchema) {
    if (simpleFieldSchemaSymbol in flexSchema) {
        return flexSchema[simpleFieldSchemaSymbol];
    }
    const fieldSchema = (0, schemaTypes_js_1.normalizeFieldSchema)(implicitSimpleSchema);
    // eslint-disable-next-line @typescript-eslint/no-explicit-any
    flexSchema[simpleFieldSchemaSymbol] = fieldSchema;
    return fieldSchema;
}
exports.getSimpleFieldSchema = getSimpleFieldSchema;
//# sourceMappingURL=getSimpleFieldSchema.js.map