"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.updateVariantStockSchema = exports.updateVariantSchema = exports.createVariantSchema = void 0;
const zod_1 = require("zod");
exports.createVariantSchema = zod_1.z.object({
    bookId: zod_1.z.string().uuid('Valid book ID is required').optional(),
    title: zod_1.z.string().min(2, 'Variant title is required').optional(),
    format: zod_1.z.enum(['HARDCOVER', 'PAPERBACK', 'EBOOK', 'AUDIOBOOK'], {
        errorMap: () => ({ message: 'Format must be HARDCOVER, PAPERBACK, EBOOK, or AUDIOBOOK' }),
    }),
    isbn: zod_1.z.string().optional().nullable(),
    sku: zod_1.z.string().min(1, 'SKU is required'),
    barcode: zod_1.z.string().optional().nullable(),
    price: zod_1.z.number().positive('Price must be greater than 0'),
    discountPrice: zod_1.z.number().positive().optional().nullable(),
    stock: zod_1.z.number().int().nonnegative('Stock cannot be negative').default(0),
    weight: zod_1.z.number().positive().optional().nullable(),
    dimensions: zod_1.z.string().optional().nullable(),
    coverImage: zod_1.z.string().url().optional().nullable(),
    digitalFileUrl: zod_1.z.string().url().optional().nullable(),
    digitalFormat: zod_1.z.enum(['PDF', 'EPUB', 'MOBI', 'AZW3', 'MP3']).optional().nullable(),
    attributes: zod_1.z.record(zod_1.z.any()).optional().nullable(),
    isDefault: zod_1.z.boolean().optional().default(false),
    isActive: zod_1.z.boolean().optional().default(true),
});
exports.updateVariantSchema = exports.createVariantSchema.partial();
exports.updateVariantStockSchema = zod_1.z.object({
    stock: zod_1.z.number().int().nonnegative('Stock cannot be negative'),
    lowStockAlert: zod_1.z.number().int().nonnegative().optional(),
});
//# sourceMappingURL=variant.validator.js.map