"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.buildUiSchema = void 0;
const getEntityThumbnailUrl_1 = require("../../core/getEntityThumbnailUrl");
const getThumbnailUiSchemaElement_1 = require("../../core/schemas/internal/getThumbnailUiSchemaElement");
const getTagItems_1 = require("../../core/schemas/internal/getTagItems");
/**
 * @private
 * constructs the complete edit uiSchema for Hub Groups
 * This defines how the schema properties should be
 * rendered in the group editing experience
 */
const buildUiSchema = async (i18nScope, options, context) => {
    return {
        type: "Layout",
        elements: [
            {
                type: "Section",
                labelKey: `${i18nScope}.sections.basicInfo.label`,
                options: {
                    helperText: {
                        labelKey: `${i18nScope}.sections.basicInfo.helperText`,
                    },
                },
                elements: [
                    {
                        labelKey: `${i18nScope}.fields.name.label`,
                        scope: "/properties/name",
                        type: "Control",
                        options: {
                            messages: [
                                {
                                    type: "ERROR",
                                    keyword: "required",
                                    icon: true,
                                    labelKey: `${i18nScope}.fields.name.requiredError`,
                                },
                                {
                                    type: "ERROR",
                                    keyword: "maxLength",
                                    icon: true,
                                    labelKey: `${i18nScope}.fields.name.maxLengthError`,
                                },
                                {
                                    type: "ERROR",
                                    keyword: "format",
                                    icon: true,
                                    labelKey: `${i18nScope}.fields.name.entityTitleValidatorError`,
                                },
                            ],
                        },
                    },
                    {
                        labelKey: `${i18nScope}.fields.summary.label`,
                        scope: "/properties/summary",
                        type: "Control",
                        options: {
                            control: "hub-field-input-input",
                            type: "textarea",
                            rows: 4,
                            messages: [
                                {
                                    type: "ERROR",
                                    keyword: "maxLength",
                                    icon: true,
                                    labelKey: `${i18nScope}.fields.summary.maxLengthError`,
                                },
                            ],
                        },
                    },
                    ...(0, getThumbnailUiSchemaElement_1.getThumbnailUiSchemaElement)(i18nScope, options.thumbnail, (0, getEntityThumbnailUrl_1.getEntityThumbnailUrl)(options), "group", context.requestOptions),
                    {
                        type: "Section",
                        labelKey: `${i18nScope}.sections.description.label`,
                        options: {
                            section: "block",
                        },
                        elements: [
                            // description
                            {
                                labelKey: `${i18nScope}.fields.description.label`,
                                scope: "/properties/description",
                                type: "Control",
                                options: {
                                    control: "hub-field-input-rich-text",
                                    type: "textarea",
                                },
                            },
                        ],
                    },
                    {
                        type: "Section",
                        labelKey: `${i18nScope}.sections.discoverability.label`,
                        options: {
                            section: "block",
                            helperText: {
                                labelKey: `${i18nScope}.sections.discoverability.helperText`,
                            },
                        },
                        elements: [
                            // tags
                            {
                                labelKey: `${i18nScope}.fields.tags.label`,
                                scope: "/properties/tags",
                                type: "Control",
                                options: {
                                    control: "hub-field-input-combobox",
                                    items: await (0, getTagItems_1.getTagItems)(options.tags, context.portal.id, context.hubRequestOptions),
                                    allowCustomValues: true,
                                    selectionMode: "multiple",
                                    placeholderIcon: "label",
                                },
                            },
                        ],
                    },
                ],
            },
        ],
    };
};
exports.buildUiSchema = buildUiSchema;
//# sourceMappingURL=GroupUiSchemaEdit.js.map