"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.getReferenceIds = void 0;
const openapi_1 = require("@samchon/openapi");
const getReferenceIds = (props) => {
    const result = new Set();
    const emplace = (key) => {
        if (key.endsWith("_id") || key.endsWith("Id"))
            result.add(key);
    };
    props.operation.parameters.forEach((p) => emplace(p.name));
    if (props.operation.requestBody) {
        openapi_1.OpenApiTypeChecker.visit({
            components: props.document.components,
            schema: { $ref: props.operation.requestBody.typeName },
            closure: (schema) => {
                var _a;
                if (openapi_1.OpenApiTypeChecker.isObject(schema) === false)
                    return;
                for (const key of Object.keys((_a = schema.properties) !== null && _a !== void 0 ? _a : {}))
                    emplace(key);
            },
        });
    }
    return Array.from(result);
};
exports.getReferenceIds = getReferenceIds;
//# sourceMappingURL=getReferenceIds.js.map