"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.ipWhitelistListResponseSchema = exports.ipWhitelistResponseSchema = exports.updateIpWhitelistSchema = exports.createIpWhitelistSchema = void 0;
const zod_1 = require("zod");
const shared_dto_1 = require("../shared/shared.dto");
const optionalString = zod_1.z.preprocess((value) => {
    if (typeof value === 'string' && value.trim() === '')
        return undefined;
    return value;
}, zod_1.z.string().trim().optional());
exports.createIpWhitelistSchema = zod_1.z.object({
    label: zod_1.z.string().min(1, 'Label is required'),
    ip_or_cidr: zod_1.z.string().min(1, 'IP address or CIDR is required').trim(),
    is_active: zod_1.z.boolean().default(true),
});
exports.updateIpWhitelistSchema = zod_1.z.object({
    label: optionalString,
    ip_or_cidr: optionalString,
    is_active: zod_1.z.boolean().optional(),
});
exports.ipWhitelistResponseSchema = zod_1.z.object({
    id: zod_1.z.string().uuid(),
    owner_id: zod_1.z.string(),
    label: shared_dto_1.defaultTransformSchema,
    ip_or_cidr: zod_1.z.string(),
    is_active: zod_1.z.boolean(),
    created_at: shared_dto_1.dateTransformSchema,
    updated_at: shared_dto_1.dateTransformSchema,
});
exports.ipWhitelistListResponseSchema = zod_1.z.array(exports.ipWhitelistResponseSchema);
//# sourceMappingURL=ip-whitelist.dto.js.map