"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.ANNOUNCEMENT_BODY_MAX_LENGTH = exports.ANNOUNCEMENT_CATEGORY_META = exports.AnnouncementCategory = exports.migrateHomepageConfig = exports.defaultHomepageConfig = exports.HOMEPAGE_MAX_BLOCKS_PER_ROW = void 0;
exports.HOMEPAGE_MAX_BLOCKS_PER_ROW = 2;
const defaultHomepageConfig = () => ({
    version: 1,
    rows: [
        {
            id: 'row-1',
            blocks: [
                {
                    id: 'block-1',
                    type: 'markdown',
                    config: {
                        content: '## Welcome\n\nEdit this homepage to get started.',
                    },
                },
            ],
        },
    ],
});
exports.defaultHomepageConfig = defaultHomepageConfig;
// `hero` (Greeting) is no longer a block type. Convert any legacy stored hero
// block into a markdown block so old configs still load, save and render — its
// {name} token keeps personalizing via the markdown block's own interpolation.
const migrateBlock = (block) => {
    if (block.type !== 'hero')
        return block;
    const legacyConfig = block.config;
    const title = typeof legacyConfig.title === 'string' ? legacyConfig.title : '';
    const subtitle = typeof legacyConfig.subtitle === 'string' ? legacyConfig.subtitle : '';
    const content = subtitle ? `## ${title}\n\n${subtitle}` : `## ${title}`;
    return { id: block.id, type: 'markdown', config: { content } };
};
const migrateHomepageConfig = (config) => ({
    ...config,
    rows: config.rows.map((row) => ({
        ...row,
        blocks: row.blocks.map(migrateBlock),
    })),
});
exports.migrateHomepageConfig = migrateHomepageConfig;
/**
 * Curated announcement categories a data team uses to signal intent to
 * business users. Fixed set (not user-managed) — each maps to a label + colour
 * in `ANNOUNCEMENT_CATEGORY_META`.
 */
var AnnouncementCategory;
(function (AnnouncementCategory) {
    /** Something new to use — a new dashboard, metric, or capability. */
    AnnouncementCategory["LAUNCH"] = "launch";
    /** Something changed — a metric definition or dashboard refresh. */
    AnnouncementCategory["UPDATE"] = "update";
    /** Something to be aware of — data delays, quality issues, maintenance. */
    AnnouncementCategory["HEADS_UP"] = "heads_up";
})(AnnouncementCategory || (exports.AnnouncementCategory = AnnouncementCategory = {}));
exports.ANNOUNCEMENT_CATEGORY_META = {
    [AnnouncementCategory.LAUNCH]: { label: 'Launch', color: 'green' },
    [AnnouncementCategory.UPDATE]: { label: 'Update', color: 'violet' },
    [AnnouncementCategory.HEADS_UP]: { label: 'Heads up', color: 'orange' },
};
/** Slack's markdown block rejects ~12k chars; cap bodies well under it */
exports.ANNOUNCEMENT_BODY_MAX_LENGTH = 8000;
//# sourceMappingURL=types.js.map