'use strict';

Object.defineProperty(exports, '__esModule', { value: true });

var z = require('zod');

const dashboardBucket = z.z.object({
    min: z.z.number().optional(),
    max: z.z.number().optional(),
    hexColour: z.z.string().optional(),
});
const BucketOptionsSchema = z.z.object({
    useRagColour: z.z.boolean().default(false),
    buckets: z.z.array(dashboardBucket).default([]),
    baseColour: z.z.string().regex(/^#/).optional(),
});
const dashboardVisFilter = z.z.object({
    id: z.z.string(),
    equals: z.z.string().nullable(),
});
const DashboardVisualisationKeySchema = z.z.object({
    id: z.z.string(),
    display: z.z.string().optional(),
    optional: z.z.boolean().default(false),
});
exports.UnitType = void 0;
(function (UnitType) {
    UnitType["NUMBER"] = "NUMBER";
    UnitType["PERCENTAGE"] = "PERCENTAGE";
})(exports.UnitType || (exports.UnitType = {}));
const DashboardVisualisationUnitType = z.z.enum(exports.UnitType);
exports.AggregateType = void 0;
(function (AggregateType) {
    AggregateType["SUM"] = "sum";
})(exports.AggregateType || (exports.AggregateType = {}));
const DashboardVisualisationAggregateType = z.z.enum(exports.AggregateType);
const DashboardVisualisationMeasureSchema = z.z.object({
    id: z.z.string(),
    display: z.z.string().optional(),
    unit: DashboardVisualisationUnitType.optional(),
    aggregate: DashboardVisualisationAggregateType.optional(),
});
const DashboardColumns = z.z.object({
    keys: z.z.array(DashboardVisualisationKeySchema).optional(),
    measures: z.z.array(DashboardVisualisationMeasureSchema, {
        error: (issue) => (issue.input === undefined ? 'measures is required' : 'measures must be an array'),
    }),
    filters: z.z.array(dashboardVisFilter).min(1).optional(),
    expectNulls: z.z.boolean().default(false),
});
const dashboardOptions = z.z.object({
    ...BucketOptionsSchema.shape,
    showLatest: z.z.boolean().default(true),
    columnsAsList: z.z.boolean().optional(),
});
const DashboardVisualisationSchema = z.z.object({
    id: z.z.string(),
    type: z.z.enum([
        'list',
        'doughnut',
        'bar',
        'bar-timeseries',
        'line',
        'scorecard',
        'scorecard-group',
        'matrix-timeseries',
        'line-timeseries',
    ]),
    display: z.z.string().optional(),
    description: z.z.string().optional(),
    options: z.z.object(dashboardOptions.shape).optional(),
    columns: z.z.object(DashboardColumns.shape),
});
const DashboardVisualisationSchemas = {
    DashboardVisualisationSchema};

exports.BucketOptionsSchema = BucketOptionsSchema;
exports.DashboardColumns = DashboardColumns;
exports.DashboardVisualisationAggregateType = DashboardVisualisationAggregateType;
exports.DashboardVisualisationMeasureSchema = DashboardVisualisationMeasureSchema;
exports.DashboardVisualisationSchema = DashboardVisualisationSchema;
exports.DashboardVisualisationUnitType = DashboardVisualisationUnitType;
exports.default = DashboardVisualisationSchemas;
//# sourceMappingURL=Validate.js.map
