'use strict';

var z = require('zod');
var Validate = require('../dashboard-visualisation/Validate.js');

const ScorecardGroupColumn = z.z.object({
    id: z.z.string(),
    display: z.z.string().optional(),
    displayValue: z.z.boolean().optional(),
    unit: z.z.enum(Validate.UnitType).optional(),
});
const ScorecardGroupSchema = z.z.object({
    ...Validate.DashboardVisualisationSchema.shape,
    type: z.z.literal('scorecard-group'),
    options: z.z.object(Validate.BucketOptionsSchema.shape).optional(),
    columns: z.z.object({
        ...Validate.DashboardColumns.shape,
        measures: z.z
            .array(ScorecardGroupColumn)
            .min(2, 'Measure must contain two or more items')
            .refine((measures) => {
            const displayValue = measures.find((m) => m.displayValue !== undefined);
            return displayValue ? measures.length === 2 : true;
        }, { error: 'Measure must have length 2 when displayValue is defined' }),
    }),
});
var ScorecardGroupSchemas = {
    ScorecardGroupSchema};

module.exports = ScorecardGroupSchemas;
//# sourceMappingURL=validate.js.map
