"use strict";
Object.defineProperty(exports, "__esModule", {
    value: true
});
function _export(target, all) {
    for(var name in all)Object.defineProperty(target, name, {
        enumerable: true,
        get: Object.getOwnPropertyDescriptor(all, name).get
    });
}
_export(exports, {
    get exportPrintersFloorsYamlSchema () {
        return exportPrintersFloorsYamlSchema;
    },
    get importPrinterPositionsSchema () {
        return importPrinterPositionsSchema;
    },
    get importPrintersFloorsYamlSchema () {
        return importPrintersFloorsYamlSchema;
    },
    get numberOrStringIdValidator () {
        return numberOrStringIdValidator;
    },
    get printerPositionsSchema () {
        return printerPositionsSchema;
    }
});
const _zod = require("zod");
const _printerservicevalidation = require("./printer-service.validation");
const _floorservicevalidation = require("./floor-service.validation");
const exportPrintersFloorsYamlSchema = _zod.z.object({
    exportPrinters: _zod.z.boolean(),
    exportFloorGrid: _zod.z.boolean(),
    exportFloors: _zod.z.boolean(),
    exportTags: _zod.z.boolean(),
    exportGroups: _zod.z.boolean().optional(),
    exportSettings: _zod.z.boolean().default(false),
    exportUsers: _zod.z.boolean().default(false),
    printerComparisonStrategiesByPriority: _zod.z.array(_zod.z.string().refine((val)=>[
            "name",
            "url",
            "id"
        ].includes(val))).min(1),
    floorComparisonStrategiesByPriority: _zod.z.string().refine((val)=>[
            "name",
            "floor",
            "id"
        ].includes(val)),
    notes: _zod.z.string().optional()
});
const numberOrStringIdValidator = _zod.z.union([
    _zod.z.number(),
    _zod.z.string()
]);
const printerPositionsSchema = _zod.z.array(_zod.z.object({
    printerId: numberOrStringIdValidator,
    floorId: numberOrStringIdValidator.optional(),
    x: _floorservicevalidation.xValidator,
    y: _floorservicevalidation.yValidator
})).min(0);
const importPrinterPositionsSchema = _zod.z.object({
    printers: printerPositionsSchema.optional()
});
const importPrintersFloorsYamlSchema = _zod.z.object({
    version: _zod.z.string().optional(),
    exportedAt: _zod.z.date().optional(),
    databaseType: _zod.z.enum([
        "mongo",
        "sqlite"
    ]).default("sqlite"),
    config: _zod.z.object({
        exportPrinters: _zod.z.boolean(),
        exportFloorGrid: _zod.z.boolean(),
        exportFloors: _zod.z.boolean(),
        exportTags: _zod.z.boolean().optional(),
        exportGroups: _zod.z.boolean().optional(),
        exportSettings: _zod.z.boolean().optional().default(false),
        exportUsers: _zod.z.boolean().optional().default(false),
        printerComparisonStrategiesByPriority: _zod.z.array(_zod.z.string().refine((val)=>[
                "name",
                "url",
                "id"
            ].includes(val))).min(1),
        floorComparisonStrategiesByPriority: _zod.z.string().refine((val)=>[
                "name",
                "floor",
                "id"
            ].includes(val))
    }),
    printers: _zod.z.array(_zod.z.object({
        id: numberOrStringIdValidator,
        printerURL: _printerservicevalidation.printerUrlValidator,
        printerType: _printerservicevalidation.printerTypeValidator,
        apiKey: _printerservicevalidation.printerApiKeyValidator,
        username: _printerservicevalidation.printerUsernameValidator.optional(),
        password: _printerservicevalidation.printerPasswordValidator.optional(),
        enabled: _printerservicevalidation.printerEnabledValidator,
        name: _printerservicevalidation.printerNameValidator,
        printerName: _zod.z.string().optional(),
        settingsAppearance: _zod.z.object({
            name: _zod.z.string().optional()
        }).optional()
    })).min(0).default([]),
    floors: _zod.z.array(_zod.z.object({
        id: numberOrStringIdValidator,
        order: _floorservicevalidation.floorOrderValidator,
        floor: _floorservicevalidation.floorOrderValidator.optional(),
        name: _floorservicevalidation.floorNameValidator,
        printers: printerPositionsSchema
    })).min(0).default([]),
    tags: _zod.z.array(_zod.z.object({
        id: numberOrStringIdValidator,
        name: _zod.z.string(),
        color: _zod.z.string().optional(),
        printers: _zod.z.array(_zod.z.object({
            printerId: numberOrStringIdValidator
        }))
    })).min(0).default([]),
    settings: _zod.z.any().optional(),
    users: _zod.z.array(_zod.z.object({
        id: numberOrStringIdValidator,
        username: _zod.z.string(),
        isDemoUser: _zod.z.boolean().optional(),
        isRootUser: _zod.z.boolean().optional(),
        isVerified: _zod.z.boolean().optional(),
        needsPasswordChange: _zod.z.boolean().optional(),
        passwordHash: _zod.z.string(),
        createdAt: _zod.z.date().optional(),
        roles: _zod.z.array(_zod.z.any()).optional()
    })).optional().default([])
});

//# sourceMappingURL=yaml-service.validation.js.map