"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const util_1 = require("../../util");
function TapSupervisionPageAdapter(input, page) {
    const { iotizeStudioConfig, configGenerator } = input;
    const usersContent = [];
    const bundleContent = [];
    for (const profile of iotizeStudioConfig.profiles()) {
        if (profile.name() === "anonymous") {
            continue;
        }
        usersContent.push({
            icon: "person",
            type: "CardLayout",
            title: `#${profile.id()} ${profile.name()}`,
            content: [
                {
                    type: "TapConfigList",
                    variableName: util_1.variablenamify(`profile-${profile.name()}ConfigItem`),
                    items: [
                        {
                            key: "ProfileLifeTime",
                            editable: true,
                            params: [
                                profile.id()
                            ]
                        },
                        {
                            key: "profilePassword",
                            editable: true,
                            params: [
                                profile.id()
                            ]
                        }
                    ]
                }
            ]
        });
    }
    for (const bundle of iotizeStudioConfig.bundles()) {
        bundleContent.push({
            type: "CardLayout",
            title: `#${bundle.id()} ${bundle.name()}`,
            content: [
                {
                    type: "TapConfigList",
                    variableName: util_1.variablenamify(`bundle-${bundle.name()}ConfigItem`),
                    items: [
                        {
                            key: "BundleDatalogPeriod",
                            editable: true,
                            params: [
                                bundle.id()
                            ]
                        }
                    ]
                }
            ]
        });
    }
    page.content = {
        type: "GridLayout",
        cols: 1,
        elements: [
            {
                type: "CardLayout",
                title: "General",
                icon: "help",
                content: [
                    {
                        type: "TapConfigList",
                        variableName: 'interfaceTapConfigItems',
                        items: [
                            {
                                key: "appName",
                                editable: true
                            }
                        ]
                    }
                ]
            },
            // {
            //     type: "CardLayout",
            //     title: "Host protocols",
            //     icon: "download",
            //     content: [
            //         {
            //             type: "ForOf",
            //             collectionName: "protocolSections",
            //             variableName: "section",
            //             content: [
            //                 {
            //                     type: "CardLayout",
            //                     title: "{{section.title}}",
            //                     content: [
            //                         {
            //                             type: "TapConfigList",
            //                             variableName: "section.items"
            //                         }
            //                     ]
            //                 }
            //             ]
            //         }
            //     ]
            // },
            // {
            //     type: "CardLayout",
            //     title: "MQTT Relay",
            //     icon: "code-working",
            //     content: [
            //         {
            //             type: "TapConfigList",
            //             variableName: 'mqttRelayConfigItems',
            //             items: [
            //                 {
            //                     key: "MqttRelayEndpoint",
            //                     editable: true,
            //                     title: 'Endpoint'
            //                 },
            //                 {
            //                     key: "MqttRelayPassword",
            //                     editable: true,
            //                     title: 'Password'
            //                 }
            //             ]
            //         }
            //     ]
            // },
            // {
            //     type: "CardLayout",
            //     title: "Cloud",
            //     icon: "cloud",
            //     content: [
            //         {
            //             type: "TapConfigList",
            //             variableName: 'cloudConfigItems',
            //             items: [
            //                 {
            //                     key: "CloudEndpoint",
            //                     editable: true,
            //                     title: 'Endpoint'
            //                 },
            //                 {
            //                     key: "CloudKey",
            //                     editable: true,
            //                     title: 'Password'
            //                 },
            //                 {
            //                     key: "CloudUploadPeriod",
            //                     editable: true
            //                 }
            //             ]
            //         }
            //     ]
            // },
            {
                type: "Text",
                content: '<h3><ion-icon name="profile"></ion-icon>Users</h3>'
            },
            ...usersContent,
            {
                type: "Text",
                content: '<h3><ion-icon name="analytics"></ion-icon>Data</h3>'
            },
            ...bundleContent
        ]
    };
    page = configGenerator.tapConfigPage(undefined, page);
    configGenerator.addMenuForSubPage(page, 'construct', "TapDevicePage");
    return page;
}
exports.default = TapSupervisionPageAdapter;
//# sourceMappingURL=TapSupervisionPageAdapter.js.map