"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.HubItemEntitySchema = void 0;
const hubEntityHero_1 = require("../../../enums/hubEntityHero");
const subschemas_1 = require("./subschemas");
/**
 * Defines a default schema for an IHubItemEntity's editiable fields.
 * All item entity schemas should leverage this base schema.
 * Reference the Project or Initiative schemas as an example
 */
exports.HubItemEntitySchema = {
    $async: true,
    type: "object",
    required: ["name"],
    properties: {
        name: subschemas_1.ENTITY_NAME_SCHEMA,
        summary: subschemas_1.ENTITY_SUMMARY_SCHEMA,
        description: { type: "string" },
        access: subschemas_1.ENTITY_ACCESS_SCHEMA,
        location: subschemas_1.ENTITY_LOCATION_SCHEMA,
        tags: subschemas_1.ENTITY_TAGS_SCHEMA,
        categories: subschemas_1.ENTITY_CATEGORIES_SCHEMA,
        isDiscussable: subschemas_1.ENTITY_IS_DISCUSSABLE_SCHEMA,
        discussionSettings: subschemas_1.DISCUSSION_SETTINGS_SCHEMA,
        view: {
            type: "object",
            properties: {
                embeds: { type: "array" },
                featuredContentIds: subschemas_1.ENTITY_FEATURED_CONTENT_SCHEMA,
                featuredImage: subschemas_1.ENTITY_IMAGE_SCHEMA,
                featuredImageAltText: { type: "string" },
                featuredImageName: { type: "string" },
                mapSettings: subschemas_1.ENTITY_MAP_SCHEMA,
                timeline: subschemas_1.ENTITY_TIMELINE_SCHEMA,
                hero: {
                    type: "string",
                    default: hubEntityHero_1.HubEntityHero.map,
                    enum: Object.keys(hubEntityHero_1.HubEntityHero),
                },
                heroActions: { type: "array" },
            },
        },
        assistant: {
            type: "object",
            required: [
                "access",
                "personality",
                "description",
                "location",
                "examplePrompts",
                "workflows",
            ],
            properties: {
                schemaVersion: { type: "number" },
                enabled: {
                    type: "boolean",
                    default: false,
                },
                access: subschemas_1.ENTITY_ACCESS_SCHEMA,
                accessGroups: { type: "array", items: { type: "string" } },
                personality: { type: "string", maxLength: 1000 },
                description: { type: "string", maxLength: 2048 },
                location: { type: "string", maxLength: 200 },
                examplePrompts: {
                    type: "array",
                    maxItems: 10,
                    items: {
                        type: "object",
                        properties: {
                            key: { type: "string" },
                            label: { type: "string", maxLength: 100 },
                        },
                    },
                },
                workflows: {
                    type: "array",
                    maxItems: 5,
                    items: {
                        type: "object",
                        properties: {
                            key: { type: "string" },
                            label: { type: "string", maxLength: 200 },
                            description: { type: "string", maxLength: 1000 },
                            action: { type: "string", enum: ["search", "respond"] },
                            response: { type: "string", maxLength: 1000 },
                            sources: { type: "array", items: { type: "string" } },
                        },
                    },
                },
                testPrompts: {
                    type: "array",
                    items: {
                        type: "object",
                        properties: {
                            key: { type: "string" },
                            label: { type: "string" },
                        },
                    },
                },
            },
        },
        // "ephemeral" properties that are not actually persisted
        // on the entity themselves - instead, they are used to
        // perform after-save actions/xhrs/transformations. For
        // example, we take the inputs from the _thumbnail property
        // to persist a thumbnail resource on the underlying item.
        _thumbnail: subschemas_1.ENTITY_IMAGE_SCHEMA,
        _slug: subschemas_1.SLUG_SCHEMA,
        _followers: {
            type: "object",
            properties: {
                groupAccess: Object.assign(Object.assign({}, subschemas_1.ENTITY_ACCESS_SCHEMA), { enum: ["private", "org", "public"] }),
                showFollowAction: {
                    type: "boolean",
                    default: true,
                },
                isDiscussable: subschemas_1.ENTITY_IS_DISCUSSABLE_SCHEMA,
            },
        },
        _associations: {
            type: "object",
            properties: {
                groupAccess: Object.assign(Object.assign({}, subschemas_1.ENTITY_ACCESS_SCHEMA), { enum: ["private", "org", "public"], default: "private" }),
                membershipAccess: {
                    type: "string",
                    enum: ["organization", "collaborators", "anyone"],
                    default: "organization",
                },
            },
        },
        _catalogSetup: subschemas_1.ENTITY_CATALOG_SETUP_SCHEMA,
        _layoutSetup: subschemas_1.ENTITY_LAYOUT_SETUP_SCHEMA,
    },
};
//# sourceMappingURL=HubItemEntitySchema.js.map