import { passInputTo, t } from './trpc.js';
import { configForProject, getConfig, queryPeriodDays } from '../../config.js';
import { collectionAndProjectInputParser } from '../../models/helpers.js';
import { getCronStatusOverview } from '../../models/cron-status.js';
export default {
    uiConfig: t.procedure.query(() => {
        var _a, _b, _c;
        return ({
            hasSummary: Boolean((_a = getConfig().azure.summaryPageGroups) === null || _a === void 0 ? void 0 : _a[0]),
            changeProgramName: (_c = (_b = getConfig().azure.collections[0]) === null || _b === void 0 ? void 0 : _b.changeProgram) === null || _c === void 0 ? void 0 : _c.name,
            queryPeriodDays: Math.floor(queryPeriodDays()),
            hasSonar: Boolean(getConfig().sonar),
        });
    }),
    projectConfig: t.procedure.input(collectionAndProjectInputParser).query(passInputTo(({ collectionName, project }) => {
        const projectConfig = configForProject(collectionName, project);
        return {
            releasePipelines: {
                stagesToHighlight: projectConfig === null || projectConfig === void 0 ? void 0 : projectConfig.releasePipelines.stagesToHighlight,
                ignoreStagesBefore: projectConfig === null || projectConfig === void 0 ? void 0 : projectConfig.releasePipelines.ignoreStagesBefore,
            },
        };
    })),
    cronStatusOverview: t.procedure.query(passInputTo(getCronStatusOverview)),
};
