import React from "react";
import { Link } from "@carbon/react";
import { ArrowRight, TrashCan, Add } from "@carbon/react/icons";
export function createAppProps() {
    return {
        name: "Console",
        ariaLabel: "Camunda Console",
        routeProps: {
            href: "https://www.camunda.com",
        },
    };
}
export function createAppBarProps(options = {}) {
    return {
        isOpen: options.useElementsFromConfig
            ? undefined
            : Boolean(options?.isOpen),
        elements: options.useElementsFromConfig
            ? undefined
            : (options?.elements ?? [
                {
                    key: "console",
                    label: "Console",
                    active: true,
                },
                {
                    key: "modeler",
                    label: "Modeler",
                    active: false,
                    routeProps: {
                        onClick: () => console.log("Redirecting to Modeler..."),
                    },
                },
                {
                    key: "tasklist",
                    label: "Tasklist",
                    active: false,
                    subElements: [
                        {
                            key: "cluster-a",
                            label: "Cluster A",
                            href: "https://camunda.com/",
                            target: "_blank",
                        },
                        {
                            key: "cluster-b",
                            label: "Cluster B",
                            onClick: () => console.log("Redirecting to Tasklist..."),
                        },
                        {
                            key: "cluster-c",
                            label: "Cluster C",
                            routeProps: {
                                onClick: () => console.log("Redirecting to Tasklist..."),
                            },
                        },
                    ],
                },
                {
                    key: "operate",
                    label: "Operate",
                    active: false,
                    target: "_blank",
                    href: "https://camunda.com/",
                },
                {
                    key: "optimize",
                    label: "Optimize",
                    active: false,
                    target: "_blank",
                    href: "https://camunda.com/",
                },
            ]),
        elementClicked: (element) => console.log(`event coming from the appBarProps: ${element} has been clicked`),
    };
}
export function createNavBarBarProps({ orgName = "Camunda", elements = undefined, showLicenseTag, showProductionLicense, isCommercial, expiresAt, } = {}) {
    return {
        elements: elements ?? [
            {
                key: "dashboard",
                label: "Dashboard",
                isCurrentPage: true,
                routeProps: {},
            },
            {
                key: "clusters",
                label: "Clusters",
                isCurrentPage: false,
                routeProps: {
                    onClick: () => console.log("Redirecting to clusters..."),
                },
            },
        ],
        orgName,
        licenseTag: {
            show: showLicenseTag || false,
            isProductionLicense: showProductionLicense || false,
            isCommercial: isCommercial || false,
            expiresAt,
        },
        tags: [
            {
                key: "githash",
                label: "example tag",
                color: "teal",
            },
            {
                key: "fooTooltip",
                label: "tooltip tag",
                color: "purple",
                tooltip: {
                    content: (React.createElement("p", null,
                        "tooltip popover with a",
                        " ",
                        React.createElement(Link, { href: "http://camunda.com/" }, "link"))),
                    buttonLabel: "open the tooltip",
                },
            },
        ],
    };
}
export function createInfoSideBarProps(options) {
    return {
        isOpen: options.isOpen,
        onOpen: () => console.log("Opened info sidebar"),
        elements: [
            {
                key: "info1",
                label: "Info 1",
            },
            {
                key: "info2",
                label: "Info 2",
                preceedingDivider: options.preceedingDividerOn2ndElement,
            },
        ],
    };
}
export function createOrgSideBarProps(options) {
    const elements = [];
    if (options.orgCount !== undefined) {
        for (let i = 0; i < options.orgCount; i++) {
            elements.push({
                key: `org-${i}`,
                label: `Organization ${i}`,
            });
        }
    }
    return {
        isOpen: options.isOpen,
        customElements: options.useConfig
            ? undefined
            : {
                activeOrganization: {
                    activeLabel: "Active Organization",
                    otherLabel: "Other Organization",
                    orgName: "Camunda",
                    action: {
                        label: "Manage",
                        onClick: () => console.log("Manage organization"),
                    },
                },
            },
        elements: options.useConfig ? undefined : elements,
        bottomElements: options.useConfig
            ? undefined
            : [
                {
                    key: "createTrial",
                    label: "Create new Trial Org",
                    renderIcon: Add,
                    onClick: () => {
                        console.log("clicked");
                    },
                },
            ],
        switchToOrg: options.useConfig
            ? (orgId) => console.log("Switch to org: ", orgId)
            : undefined,
    };
}
export function createUserSideBarProps(options) {
    return {
        isOpen: options.isOpen,
        version: "8.3.0-alpha4",
        customElements: {
            customSection: options.customSection,
            profile: {
                label: "Profile",
                user: {
                    email: "teamcloud@camunda.com",
                    name: "Team Cloud",
                },
            },
            themeSelector: options.hideThemeSelector
                ? undefined
                : {
                    currentTheme: "dark",
                    onChange: (newTheme) => console.log(`Selected ${newTheme} theme`),
                },
            stageToggle: {
                prodFeaturesEnabled: true,
                toggle: () => console.log("Toggle stage"),
            },
        },
        elements: [
            {
                key: "cookie",
                label: "Cookie Preferences",
            },
            {
                key: "terms",
                label: "Terms of use",
            },
            {
                key: "logout",
                label: "Log out",
                kind: "ghost",
                renderIcon: ArrowRight,
            },
        ],
        bottomElements: [
            {
                key: "delete",
                label: "Delete account",
                kind: "danger--ghost",
                renderIcon: TrashCan,
            },
        ],
    };
}
export function createNotificationSideBarProps(options) {
    return {
        isOpen: options.isOpen,
    };
}
export const createHelpCenterProps = (options) => ({
    origin: options?.origin || "console",
    theme: options?.theme,
    autoStartSurvey: options?.autoStartSurvey,
    mixpanelTrack: (event, data) => console.log(`Mixpanel event ${event} tracked: ${JSON.stringify(data)}`),
});
