"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.buildUiSchema = void 0;
const wellKnownCatalog_1 = require("../../../../search/wellKnownCatalog");
const uiSchemaRuleEffects_1 = require("../../../enums/uiSchemaRuleEffects");
// Get the catalogs for the entity gallery picker
function getCatalogs(user) {
    const catalogNames = ["myContent", "organization"];
    return catalogNames.map((name) => {
        const opts = {
            user,
            collectionNames: ["site"],
        };
        const catalog = (0, wellKnownCatalog_1.getWellKnownCatalog)("selectContent.facets", name, "item", opts);
        return catalog;
    });
}
const buildUiSchema = (i18nScope, config, context) => {
    return Promise.resolve({
        type: "Layout",
        elements: [
            {
                labelKey: "selectContent.title",
                scope: "/properties/entityId",
                type: "Control",
                options: {
                    control: "hub-field-input-gallery-picker",
                    targetEntity: "item",
                    catalogs: getCatalogs(context.currentUser),
                    facets: [
                        {
                            label: "{{selectContent.facets.sharing:translate}}",
                            key: "access",
                            display: "multi-select",
                            field: "access",
                            options: [],
                            operation: "OR",
                        },
                    ],
                },
            },
            {
                type: "Section",
                labelKey: "callToAction.title",
                rule: HIDE_FOR_NO_ENTITY_ID,
                options: {
                    helperText: {
                        labelKey: "callToAction.helperText",
                    },
                },
                elements: [
                    {
                        scope: "/properties/callToActionText",
                        type: "Control",
                        options: {
                            type: "textarea",
                            rows: 4,
                        },
                    },
                    {
                        labelKey: "callToAction.alignment",
                        scope: "/properties/callToActionAlign",
                        type: "Control",
                        options: {
                            control: "hub-field-input-alignment",
                        },
                    },
                ],
            },
            {
                type: "Section",
                labelKey: "followButton.title",
                options: {
                    helperText: {
                        labelKey: "followButton.helperText",
                    },
                },
                rule: HIDE_FOR_NO_ENTITY_ID,
                elements: [
                    {
                        labelKey: "followButton.buttonText",
                        scope: "/properties/buttonText",
                        type: "Control",
                        options: {
                            control: "hub-field-input-input",
                        },
                    },
                    {
                        labelKey: "followButton.unfollowButtonText",
                        scope: "/properties/unfollowButtonText",
                        type: "Control",
                        options: {
                            control: "hub-field-input-input",
                        },
                    },
                    {
                        labelKey: "followButton.alignment",
                        scope: "/properties/buttonAlign",
                        type: "Control",
                        options: {
                            control: "hub-field-input-alignment",
                        },
                    },
                    {
                        labelKey: "followButton.buttonStyle",
                        scope: "/properties/buttonStyle",
                        type: "Control",
                        options: {
                            control: "hub-field-input-select",
                            labels: [
                                "{{followButton.solid:translate}}",
                                "{{followButton.outline:translate}}",
                            ],
                        },
                    },
                ],
            },
        ],
    });
};
exports.buildUiSchema = buildUiSchema;
const HIDE_FOR_NO_ENTITY_ID = {
    effect: uiSchemaRuleEffects_1.UiSchemaRuleEffects.HIDE,
    condition: {
        scope: "/properties/entityId",
        schema: { const: [] },
    },
};
//# sourceMappingURL=FollowCardUiSchema.js.map