"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.Body = void 0;
const tslib_1 = require("tslib");
const classnames_1 = tslib_1.__importDefault(require("classnames"));
const React = tslib_1.__importStar(require("react"));
const guards_1 = require("../../../utils/guards");
const MarkdownViewer_1 = require("../../MarkdownViewer");
const SchemaViewer_1 = require("../../SchemaViewer");
const SectionTitle_1 = require("./SectionTitle");
const utils_1 = require("./utils");
exports.Body = ({ body, className }) => {
    if (typeof body !== 'object' || !body.contents)
        return null;
    const content = body.contents && body.contents[0];
    const schema = content === null || content === void 0 ? void 0 : content.schema;
    const examples = utils_1.getExamplesObject((content === null || content === void 0 ? void 0 : content.examples) || []);
    if (!content || (!body.description && !schema && !examples))
        return null;
    return (React.createElement("div", { className: classnames_1.default('HttpOperation__Body', className) },
        React.createElement(SectionTitle_1.SectionTitle, { title: "Request Body" }),
        body.description && React.createElement(MarkdownViewer_1.MarkdownViewer, { className: "mt-6", markdown: body.description }),
        guards_1.isJSONSchema(schema) && React.createElement(SchemaViewer_1.SchemaViewer, { className: "mt-6", schema: schema, examples: examples })));
};
exports.Body.displayName = 'HttpOperation.Body';
//# sourceMappingURL=Body.js.map