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