"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.filterProbationSchema = exports.reviewProbationSchema = exports.createProbationSchema = exports.probationOutcomeSchema = exports.probationStatusSchema = void 0;
const zod_1 = require("zod");
const optionalString = zod_1.z.preprocess((val) => {
    if (typeof val === 'string' && val.trim() === '')
        return undefined;
    return val;
}, zod_1.z.string().trim().optional());
const optionalDate = zod_1.z.preprocess((val) => {
    if (val === null || val === undefined || val === '')
        return undefined;
    return val;
}, zod_1.z.coerce.date().optional());
exports.probationStatusSchema = zod_1.z.enum(['pending', 'under_review', 'passed', 'extended', 'failed']);
exports.probationOutcomeSchema = zod_1.z.enum(['pass', 'extend', 'fail']);
exports.createProbationSchema = zod_1.z.object({
    member_id: zod_1.z.string().min(1),
    onboarding_case_id: optionalString,
    start_date: optionalDate,
    duration_months: zod_1.z.number().int().min(1).default(3),
    manager_id: optionalString,
    notes: optionalString,
});
exports.reviewProbationSchema = zod_1.z.object({
    outcome: exports.probationOutcomeSchema,
    extension_months: zod_1.z.number().int().min(1).optional(),
    comments: optionalString,
});
exports.filterProbationSchema = zod_1.z.object({
    page: zod_1.z.preprocess((val) => Number(val) || 1, zod_1.z.number().int().min(1).default(1)),
    limit: zod_1.z.preprocess((val) => Number(val) || 10, zod_1.z.number().int().min(1).max(100).default(10)),
    search: optionalString,
    status: exports.probationStatusSchema.optional(),
    member_id: optionalString,
});
//# sourceMappingURL=probation.dto.js.map