"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.Page = void 0;
const react_1 = require("react");
const react_helmet_async_1 = require("react-helmet-async");
const back_link_1 = require("@not-govuk/back-link");
const breadcrumbs_1 = require("@not-govuk/breadcrumbs");
const component_helpers_1 = require("@not-govuk/component-helpers");
const footer_1 = require("@not-govuk/footer");
const header_1 = require("@not-govuk/header");
const link_1 = require("@not-govuk/link");
const phase_banner_1 = require("@not-govuk/phase-banner");
const skip_link_1 = require("@not-govuk/skip-link");
const width_container_1 = require("@not-govuk/width-container");
require("../assets/Page.scss");
const Page = ({ backHref, breadcrumbs, children, classBlock, classModifiers: _classModifiers, className, department, feedbackHref, footerContent, footerNavigation, govUK, maxContentsWidth, meta, metaTitle, navigation, organisationHref, organisationText, phase, phaseBannerContent, serviceHref, serviceName: _serviceName, signOutHref, signOutText, title: _title, ...attrs }) => {
    const classModifiers = (Array.isArray(_classModifiers)
        ? _classModifiers
        : [_classModifiers]);
    const classes = (0, component_helpers_1.classBuilder)('not-govuk-page', classBlock, [...classModifiers, department], className);
    const serviceName = _serviceName || _title;
    const title = _title || _serviceName || 'NotGovUK';
    const headerProps = {
        department,
        govUK,
        maxContentsWidth,
        navigation,
        organisationHref,
        organisationText,
        serviceHref,
        serviceName,
        signOutHref,
        signOutText
    };
    const footerProps = {
        govUK,
        maxContentsWidth,
        meta,
        metaTitle,
        navigation: footerNavigation
    };
    const mainId = 'main-content';
    return ((0, react_1.createElement)("div", { ...attrs, className: classes() },
        (0, react_1.createElement)(react_helmet_async_1.Helmet, null,
            (0, react_1.createElement)("title", null, title),
            (0, react_1.createElement)("meta", { name: "viewport", content: "width=device-width, initial-scale=1, viewport-fit=cover" }),
            (0, react_1.createElement)("meta", { httpEquiv: "X-UA-Compatible", content: "IE=edge" })),
        (0, react_1.createElement)(skip_link_1.SkipLink, { id: "skip-link", for: mainId }, "Skip to main content"),
        (0, react_1.createElement)(header_1.Header, { ...headerProps, className: classes('header') }),
        (0, react_1.createElement)("div", { className: classes('body') },
            (0, react_1.createElement)(width_container_1.WidthContainer, { maxWidth: maxContentsWidth, className: classes('container') },
                !phase ? null : ((0, react_1.createElement)(phase_banner_1.PhaseBanner, { id: "phase-banner", phase: phase }, phaseBannerContent || ((0, react_1.createElement)(react_1.Fragment, null,
                    "This is a new service - your ",
                    feedbackHref
                        ? ((0, react_1.createElement)(link_1.A, { href: feedbackHref }, "feedback"))
                        : 'feedback',
                    " will help us to improve it.")))),
                (breadcrumbs === null || breadcrumbs === void 0 ? void 0 : breadcrumbs.length)
                    ? ((0, react_1.createElement)(breadcrumbs_1.Breadcrumbs, { id: "breadcrumbs", items: breadcrumbs }))
                    : (!backHref ? null : ((0, react_1.createElement)(back_link_1.BackLink, { id: "back-link", href: backHref }))),
                (0, react_1.createElement)("main", { id: mainId, role: "main", className: classes('main') }, children))),
        (0, react_1.createElement)(footer_1.Footer, { ...footerProps, className: classes('footer') }, footerContent)));
};
exports.Page = Page;
exports.default = exports.Page;
