"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.designationsResponseSchema = exports.designationResponseSchema = exports.updateDesignationSchema = exports.createDesignationSchema = 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());
const statusSchema = zod_1.z.enum(['active', 'inactive', 'deleted']);
exports.createDesignationSchema = zod_1.z.object({
    name: zod_1.z
        .string()
        .trim()
        .min(2, { message: 'Designation name must be at least 2 characters long' }),
    designation_code: zod_1.z
        .string()
        .trim()
        .min(1, { message: 'Designation code is required' }),
    description: optionalString,
    status: statusSchema.optional(),
});
exports.updateDesignationSchema = exports.createDesignationSchema
    .partial()
    .refine((data) => Object.keys(data).length > 0, {
    message: 'At least one field must be provided',
});
exports.designationResponseSchema = zod_1.z.object({
    id: zod_1.z.string().uuid().optional(),
    name: zod_1.z.string().optional(),
    designation_code: zod_1.z.string().optional(),
    description: shared_dto_1.defaultTransformSchema,
    status: statusSchema.optional(),
    created_at: shared_dto_1.dateTransformSchema,
    updated_at: shared_dto_1.dateTransformSchema,
});
exports.designationsResponseSchema = zod_1.z.array(exports.designationResponseSchema);
//# sourceMappingURL=designations.dto.js.map