"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.filterOnboardingCaseSchema = exports.submitSurveyResponseSchema = exports.assignBuddySchema = exports.updateProvisioningItemSchema = exports.createProvisioningItemSchema = exports.signOnboardingDocumentSchema = exports.updateOnboardingTaskSchema = exports.createOnboardingTaskSchema = exports.updateOnboardingCaseSchema = exports.createOnboardingCaseSchema = exports.updateOnboardingTemplateSchema = exports.createOnboardingTemplateSchema = exports.provisioningStatusSchema = exports.documentSigningStatusSchema = exports.onboardingCaseStatusSchema = exports.taskStatusEnumSchema = exports.priorityEnumSchema = exports.taskOwnerTypeEnumSchema = 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.taskOwnerTypeEnumSchema = zod_1.z.enum(['hr', 'it', 'manager', 'employee', 'finance']);
exports.priorityEnumSchema = zod_1.z.enum(['low', 'medium', 'high', 'critical']);
exports.taskStatusEnumSchema = zod_1.z.enum(['pending', 'in_progress', 'completed', 'skipped']);
exports.onboardingCaseStatusSchema = zod_1.z.enum(['pending', 'in_progress', 'completed', 'cancelled']);
exports.documentSigningStatusSchema = zod_1.z.enum(['pending', 'signed', 'rejected']);
exports.provisioningStatusSchema = zod_1.z.enum(['pending', 'requested', 'assigned', 'provisioned', 'confirmed', 'rejected']);
exports.createOnboardingTemplateSchema = zod_1.z.object({
    title: zod_1.z.string().min(2),
    description: optionalString,
    is_active: zod_1.z.boolean().optional().default(true),
    is_default: zod_1.z.boolean().optional().default(false),
    tasks: zod_1.z.array(zod_1.z.object({
        title: zod_1.z.string().min(2),
        description: optionalString,
        owner_type: exports.taskOwnerTypeEnumSchema.default('hr'),
        priority: exports.priorityEnumSchema.default('medium'),
        relative_due_days: zod_1.z.number().int().default(7),
        order_index: zod_1.z.number().int().default(0),
    })).optional(),
});
exports.updateOnboardingTemplateSchema = exports.createOnboardingTemplateSchema.partial();
exports.createOnboardingCaseSchema = zod_1.z.object({
    member_id: zod_1.z.string().min(1),
    job_application_id: optionalString,
    template_id: optionalString,
    start_date: optionalDate,
    target_completion_date: optionalDate,
    notes: optionalString,
});
exports.updateOnboardingCaseSchema = zod_1.z.object({
    status: exports.onboardingCaseStatusSchema.optional(),
    start_date: optionalDate,
    target_completion_date: optionalDate,
    notes: optionalString,
});
exports.createOnboardingTaskSchema = zod_1.z.object({
    title: zod_1.z.string().min(2),
    description: optionalString,
    owner_type: exports.taskOwnerTypeEnumSchema.default('hr'),
    assigned_member_id: optionalString,
    due_date: optionalDate,
    priority: exports.priorityEnumSchema.default('medium'),
    order_index: zod_1.z.number().int().default(0),
    notes: optionalString,
});
exports.updateOnboardingTaskSchema = zod_1.z.object({
    title: optionalString,
    description: optionalString,
    owner_type: exports.taskOwnerTypeEnumSchema.optional(),
    assigned_member_id: optionalString,
    due_date: optionalDate,
    priority: exports.priorityEnumSchema.optional(),
    status: exports.taskStatusEnumSchema.optional(),
    notes: optionalString,
});
exports.signOnboardingDocumentSchema = zod_1.z.object({
    file_url: optionalString,
    signature_metadata: zod_1.z.record(zod_1.z.string(), zod_1.z.any()).optional(),
    notes: optionalString,
});
exports.createProvisioningItemSchema = zod_1.z.object({
    item_name: zod_1.z.string().min(2),
    item_type: zod_1.z.string().default('hardware'),
    description: optionalString,
    owner_type: exports.taskOwnerTypeEnumSchema.default('it'),
    assigned_member_id: optionalString,
    serial_number: optionalString,
    notes: optionalString,
});
exports.updateProvisioningItemSchema = zod_1.z.object({
    status: exports.provisioningStatusSchema.optional(),
    serial_number: optionalString,
    notes: optionalString,
});
exports.assignBuddySchema = zod_1.z.object({
    buddy_member_id: zod_1.z.string().min(1),
    start_date: optionalDate,
    end_date: optionalDate,
    notes: optionalString,
});
exports.submitSurveyResponseSchema = zod_1.z.object({
    responses: zod_1.z.record(zod_1.z.string(), zod_1.z.any()),
    notes: optionalString,
});
exports.filterOnboardingCaseSchema = 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.onboardingCaseStatusSchema.optional(),
    member_id: optionalString,
});
//# sourceMappingURL=onboarding.dto.js.map