"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
    return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
var react_1 = require("@graphiql/react");
var react_2 = __importDefault(require("react"));
function SchemaDoc() {
    var _a, _b;
    var schema = (0, react_1.useSchemaContext)({ nonNull: true }).schema;
    var explorerNavStack = (0, react_1.useExplorerContext)({ nonNull: true }).explorerNavStack;
    if (!schema || explorerNavStack.length > 1) {
        return null;
    }
    var queryType = schema.getQueryType();
    var mutationType = (_a = schema.getMutationType) === null || _a === void 0 ? void 0 : _a.call(schema);
    var subscriptionType = (_b = schema.getSubscriptionType) === null || _b === void 0 ? void 0 : _b.call(schema);
    return (react_2.default.createElement(react_2.default.Fragment, null,
        react_2.default.createElement(react_1.MarkdownContent, { type: "description" }, schema.description ||
            'A GraphQL schema provides a root type for each kind of operation.'),
        react_2.default.createElement(react_1.ExplorerSection, { title: "Root types" },
            queryType ? (react_2.default.createElement("div", null,
                react_2.default.createElement("span", { className: "graphiql-doc-explorer-root-type" }, "query: "),
                react_2.default.createElement(react_1.TypeLink, { type: queryType }))) : null,
            mutationType && (react_2.default.createElement("div", null,
                react_2.default.createElement("span", { className: "graphiql-doc-explorer-root-type" }, "mutation: "),
                react_2.default.createElement(react_1.TypeLink, { type: mutationType }))),
            subscriptionType && (react_2.default.createElement("div", null,
                react_2.default.createElement("span", { className: "graphiql-doc-explorer-root-type" },
                    "subscription:",
                    ' '),
                react_2.default.createElement(react_1.TypeLink, { type: subscriptionType }))))));
}
exports.default = SchemaDoc;
//# sourceMappingURL=SchemaDoc.js.map