import { z } from 'zod';

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

export { AggregateType, BucketOptionsSchema, DashboardColumns, DashboardVisualisationAggregateType, DashboardVisualisationMeasureSchema, DashboardVisualisationSchema, DashboardVisualisationUnitType, UnitType, DashboardVisualisationSchemas as default };
//# sourceMappingURL=Validate.js.map
