@t4dhg/mcp-factorial 1.1.0 → 3.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (52) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +175 -58
  3. package/dist/api.d.ts +424 -8
  4. package/dist/api.d.ts.map +1 -1
  5. package/dist/api.js +1156 -100
  6. package/dist/api.js.map +1 -1
  7. package/dist/audit.d.ts +86 -0
  8. package/dist/audit.d.ts.map +1 -0
  9. package/dist/audit.js +119 -0
  10. package/dist/audit.js.map +1 -0
  11. package/dist/cache.d.ts +88 -0
  12. package/dist/cache.d.ts.map +1 -0
  13. package/dist/cache.js +169 -0
  14. package/dist/cache.js.map +1 -0
  15. package/dist/config.d.ts +57 -0
  16. package/dist/config.d.ts.map +1 -0
  17. package/dist/config.js +112 -0
  18. package/dist/config.js.map +1 -0
  19. package/dist/confirmation.d.ts +118 -0
  20. package/dist/confirmation.d.ts.map +1 -0
  21. package/dist/confirmation.js +153 -0
  22. package/dist/confirmation.js.map +1 -0
  23. package/dist/errors.d.ts +133 -0
  24. package/dist/errors.d.ts.map +1 -0
  25. package/dist/errors.js +251 -0
  26. package/dist/errors.js.map +1 -0
  27. package/dist/http-client.d.ts +80 -0
  28. package/dist/http-client.d.ts.map +1 -0
  29. package/dist/http-client.js +243 -0
  30. package/dist/http-client.js.map +1 -0
  31. package/dist/index.d.ts +12 -2
  32. package/dist/index.d.ts.map +1 -1
  33. package/dist/index.js +3272 -73
  34. package/dist/index.js.map +1 -1
  35. package/dist/pagination.d.ts +96 -0
  36. package/dist/pagination.d.ts.map +1 -0
  37. package/dist/pagination.js +114 -0
  38. package/dist/pagination.js.map +1 -0
  39. package/dist/schemas.d.ts +1789 -0
  40. package/dist/schemas.d.ts.map +1 -0
  41. package/dist/schemas.js +718 -0
  42. package/dist/schemas.js.map +1 -0
  43. package/dist/types.d.ts +61 -50
  44. package/dist/types.d.ts.map +1 -1
  45. package/dist/types.js +6 -1
  46. package/dist/types.js.map +1 -1
  47. package/dist/write-safety.d.ts +53 -0
  48. package/dist/write-safety.d.ts.map +1 -0
  49. package/dist/write-safety.js +239 -0
  50. package/dist/write-safety.js.map +1 -0
  51. package/llms.txt +115 -0
  52. package/package.json +63 -7
@@ -0,0 +1,718 @@
1
+ /**
2
+ * Zod schemas for runtime validation of API responses
3
+ *
4
+ * Catches API version mismatches and ensures type safety at runtime.
5
+ */
6
+ import { z } from 'zod';
7
+ import { SchemaValidationError } from './errors.js';
8
+ /**
9
+ * Employee schema
10
+ */
11
+ export const EmployeeSchema = z.object({
12
+ id: z.number(),
13
+ first_name: z.string().nullable(),
14
+ last_name: z.string().nullable(),
15
+ full_name: z.string().nullable(),
16
+ email: z.string().nullable(),
17
+ birthday_on: z.string().nullable(),
18
+ hired_on: z.string().nullable(),
19
+ start_date: z.string().nullable(),
20
+ terminated_on: z.string().nullable(),
21
+ gender: z.string().nullable(),
22
+ nationality: z.string().nullable(),
23
+ manager_id: z.number().nullable(),
24
+ role: z.string().nullable(),
25
+ timeoff_manager_id: z.number().nullable(),
26
+ company_id: z.number().nullable(),
27
+ legal_entity_id: z.number().nullable(),
28
+ team_ids: z.array(z.number()).default([]),
29
+ location_id: z.number().nullable(),
30
+ created_at: z.string().nullable(),
31
+ updated_at: z.string().nullable(),
32
+ });
33
+ /**
34
+ * Team schema
35
+ */
36
+ export const TeamSchema = z.object({
37
+ id: z.number(),
38
+ name: z.string(),
39
+ description: z.string().nullable(),
40
+ company_id: z.number().nullable(),
41
+ employee_ids: z.array(z.number()).default([]),
42
+ lead_ids: z.array(z.number()).default([]),
43
+ created_at: z.string().nullable(),
44
+ updated_at: z.string().nullable(),
45
+ });
46
+ /**
47
+ * Location schema
48
+ */
49
+ export const LocationSchema = z.object({
50
+ id: z.number(),
51
+ name: z.string(),
52
+ country: z.string().nullable(),
53
+ phone_number: z.string().nullable(),
54
+ state: z.string().nullable(),
55
+ city: z.string().nullable(),
56
+ address_line_1: z.string().nullable(),
57
+ address_line_2: z.string().nullable(),
58
+ postal_code: z.string().nullable(),
59
+ company_id: z.number().nullable(),
60
+ created_at: z.string().nullable(),
61
+ updated_at: z.string().nullable(),
62
+ });
63
+ /**
64
+ * Contract schema
65
+ */
66
+ export const ContractSchema = z.object({
67
+ id: z.number(),
68
+ employee_id: z.number(),
69
+ job_title: z.string().nullable(),
70
+ effective_on: z.string().nullable(),
71
+ created_at: z.string().nullable(),
72
+ updated_at: z.string().nullable(),
73
+ });
74
+ /**
75
+ * Leave schema
76
+ */
77
+ export const LeaveSchema = z.object({
78
+ id: z.number(),
79
+ employee_id: z.number(),
80
+ leave_type_id: z.number(),
81
+ start_on: z.string(),
82
+ finish_on: z.string(),
83
+ half_day: z.enum(['all_day', 'start', 'finish']).nullable(),
84
+ status: z.enum(['pending', 'approved', 'declined']),
85
+ description: z.string().nullable(),
86
+ deleted_at: z.string().nullable(),
87
+ duration_attributes: z
88
+ .object({
89
+ days: z.number(),
90
+ hours: z.number(),
91
+ })
92
+ .nullable(),
93
+ created_at: z.string().nullable(),
94
+ updated_at: z.string().nullable(),
95
+ });
96
+ /**
97
+ * Leave type schema
98
+ */
99
+ export const LeaveTypeSchema = z.object({
100
+ id: z.number(),
101
+ name: z.string(),
102
+ code: z.string().nullable(),
103
+ color: z.string().nullable(),
104
+ description: z.string().nullable(),
105
+ company_id: z.number().nullable(),
106
+ created_at: z.string().nullable(),
107
+ updated_at: z.string().nullable(),
108
+ });
109
+ /**
110
+ * Allowance schema
111
+ */
112
+ export const AllowanceSchema = z.object({
113
+ id: z.number(),
114
+ employee_id: z.number(),
115
+ leave_type_id: z.number(),
116
+ policy_id: z.number().nullable(),
117
+ balance_days: z.number(),
118
+ consumed_days: z.number(),
119
+ available_days: z.number(),
120
+ valid_from: z.string().nullable(),
121
+ valid_to: z.string().nullable(),
122
+ created_at: z.string().nullable(),
123
+ updated_at: z.string().nullable(),
124
+ });
125
+ /**
126
+ * Shift schema
127
+ */
128
+ export const ShiftSchema = z.object({
129
+ id: z.number(),
130
+ employee_id: z.number(),
131
+ clock_in: z.string(),
132
+ clock_out: z.string().nullable(),
133
+ worked_hours: z.number().nullable(),
134
+ break_minutes: z.number().nullable(),
135
+ location: z.string().nullable(),
136
+ notes: z.string().nullable(),
137
+ created_at: z.string().nullable(),
138
+ updated_at: z.string().nullable(),
139
+ });
140
+ /**
141
+ * Folder schema
142
+ */
143
+ export const FolderSchema = z.object({
144
+ id: z.number(),
145
+ name: z.string(),
146
+ parent_id: z.number().nullable(),
147
+ company_id: z.number().nullable(),
148
+ created_at: z.string().nullable(),
149
+ updated_at: z.string().nullable(),
150
+ });
151
+ /**
152
+ * Document schema
153
+ */
154
+ export const DocumentSchema = z.object({
155
+ id: z.number(),
156
+ name: z.string(),
157
+ folder_id: z.number().nullable(),
158
+ author_id: z.number().nullable(),
159
+ company_id: z.number().nullable(),
160
+ public: z.boolean().default(false),
161
+ space: z.string().nullable(),
162
+ file_url: z.string().nullable(),
163
+ mime_type: z.string().nullable(),
164
+ size_bytes: z.number().nullable(),
165
+ created_at: z.string().nullable(),
166
+ updated_at: z.string().nullable(),
167
+ });
168
+ /**
169
+ * Job role schema
170
+ */
171
+ export const JobRoleSchema = z.object({
172
+ id: z.number(),
173
+ name: z.string(),
174
+ description: z.string().nullable(),
175
+ company_id: z.number().nullable(),
176
+ created_at: z.string().nullable(),
177
+ updated_at: z.string().nullable(),
178
+ });
179
+ /**
180
+ * Job level schema
181
+ */
182
+ export const JobLevelSchema = z.object({
183
+ id: z.number(),
184
+ name: z.string(),
185
+ description: z.string().nullable(),
186
+ company_id: z.number().nullable(),
187
+ created_at: z.string().nullable(),
188
+ updated_at: z.string().nullable(),
189
+ });
190
+ // ============================================================================
191
+ // Write Input Schemas (for create/update operations)
192
+ // ============================================================================
193
+ /**
194
+ * Date string pattern (YYYY-MM-DD)
195
+ */
196
+ const datePattern = /^\d{4}-\d{2}-\d{2}$/;
197
+ const dateString = z.string().regex(datePattern, 'Date must be in YYYY-MM-DD format');
198
+ /**
199
+ * Employee create input schema
200
+ */
201
+ export const CreateEmployeeInputSchema = z.object({
202
+ first_name: z.string().min(1).max(100),
203
+ last_name: z.string().min(1).max(100),
204
+ email: z.string().email(),
205
+ birthday_on: dateString.optional(),
206
+ hired_on: dateString.optional(),
207
+ start_date: dateString.optional(),
208
+ gender: z.enum(['male', 'female', 'other']).optional(),
209
+ nationality: z.string().max(50).optional(),
210
+ manager_id: z.number().positive().optional(),
211
+ role: z.string().max(100).optional(),
212
+ team_ids: z.array(z.number().positive()).optional(),
213
+ location_id: z.number().positive().optional(),
214
+ });
215
+ /**
216
+ * Employee update input schema (all fields optional)
217
+ */
218
+ export const UpdateEmployeeInputSchema = CreateEmployeeInputSchema.partial();
219
+ /**
220
+ * Employee termination input schema
221
+ */
222
+ export const TerminateEmployeeInputSchema = z.object({
223
+ terminated_on: dateString,
224
+ reason: z.string().max(500).optional(),
225
+ });
226
+ /**
227
+ * Team create input schema
228
+ */
229
+ export const CreateTeamInputSchema = z.object({
230
+ name: z.string().min(1).max(100),
231
+ description: z.string().max(500).optional(),
232
+ lead_ids: z.array(z.number().positive()).optional(),
233
+ employee_ids: z.array(z.number().positive()).optional(),
234
+ });
235
+ /**
236
+ * Team update input schema
237
+ */
238
+ export const UpdateTeamInputSchema = CreateTeamInputSchema.partial();
239
+ /**
240
+ * Location create input schema
241
+ */
242
+ export const CreateLocationInputSchema = z.object({
243
+ name: z.string().min(1).max(100),
244
+ country: z.string().max(50).optional(),
245
+ state: z.string().max(50).optional(),
246
+ city: z.string().max(50).optional(),
247
+ address_line_1: z.string().max(200).optional(),
248
+ address_line_2: z.string().max(200).optional(),
249
+ postal_code: z.string().max(20).optional(),
250
+ phone_number: z.string().max(30).optional(),
251
+ });
252
+ /**
253
+ * Location update input schema
254
+ */
255
+ export const UpdateLocationInputSchema = CreateLocationInputSchema.partial();
256
+ /**
257
+ * Leave create input schema
258
+ */
259
+ export const CreateLeaveInputSchema = z.object({
260
+ employee_id: z.number().positive(),
261
+ leave_type_id: z.number().positive(),
262
+ start_on: dateString,
263
+ finish_on: dateString,
264
+ half_day: z.enum(['all_day', 'start', 'finish']).optional(),
265
+ description: z.string().max(500).optional(),
266
+ });
267
+ /**
268
+ * Leave update input schema
269
+ */
270
+ export const UpdateLeaveInputSchema = CreateLeaveInputSchema.partial().omit({ employee_id: true });
271
+ /**
272
+ * Leave approval/rejection input schema
273
+ */
274
+ export const LeaveDecisionInputSchema = z.object({
275
+ reason: z.string().max(500).optional(),
276
+ });
277
+ /**
278
+ * Shift create input schema
279
+ */
280
+ export const CreateShiftInputSchema = z.object({
281
+ employee_id: z.number().positive(),
282
+ clock_in: z.string().datetime(),
283
+ clock_out: z.string().datetime().optional(),
284
+ break_minutes: z.number().min(0).max(480).optional(),
285
+ location: z.string().max(200).optional(),
286
+ notes: z.string().max(500).optional(),
287
+ });
288
+ /**
289
+ * Shift update input schema
290
+ */
291
+ export const UpdateShiftInputSchema = CreateShiftInputSchema.partial().omit({ employee_id: true });
292
+ // ============================================================================
293
+ // New Entity Schemas (Projects, Training, ATS, Work Areas, Payroll)
294
+ // ============================================================================
295
+ /**
296
+ * Project schema
297
+ */
298
+ export const ProjectSchema = z.object({
299
+ id: z.number(),
300
+ name: z.string(),
301
+ code: z.string().nullable(),
302
+ description: z.string().nullable(),
303
+ status: z.enum(['active', 'inactive', 'archived']).nullable(),
304
+ employees_assignment: z.enum(['manual', 'company']).nullable(),
305
+ company_id: z.number().nullable(),
306
+ created_at: z.string().nullable(),
307
+ updated_at: z.string().nullable(),
308
+ });
309
+ /**
310
+ * Project create input schema
311
+ */
312
+ export const CreateProjectInputSchema = z.object({
313
+ name: z.string().min(1).max(100),
314
+ code: z.string().max(20).optional(),
315
+ description: z.string().max(500).optional(),
316
+ employees_assignment: z.enum(['manual', 'company']).optional(),
317
+ });
318
+ /**
319
+ * Project update input schema
320
+ */
321
+ export const UpdateProjectInputSchema = CreateProjectInputSchema.partial().extend({
322
+ status: z.enum(['active', 'inactive', 'archived']).optional(),
323
+ });
324
+ /**
325
+ * Project Task schema
326
+ */
327
+ export const ProjectTaskSchema = z.object({
328
+ id: z.number(),
329
+ name: z.string(),
330
+ project_id: z.number(),
331
+ subproject_id: z.number().nullable(),
332
+ description: z.string().nullable(),
333
+ completed: z.boolean().default(false),
334
+ due_on: z.string().nullable(),
335
+ due_status: z.string().nullable(),
336
+ created_at: z.string().nullable(),
337
+ updated_at: z.string().nullable(),
338
+ });
339
+ /**
340
+ * Project Task create input schema
341
+ */
342
+ export const CreateProjectTaskInputSchema = z.object({
343
+ name: z.string().min(1).max(100),
344
+ project_id: z.number().positive(),
345
+ description: z.string().max(500).optional(),
346
+ due_on: dateString.optional(),
347
+ });
348
+ /**
349
+ * Project Task update input schema
350
+ */
351
+ export const UpdateProjectTaskInputSchema = CreateProjectTaskInputSchema.partial()
352
+ .omit({ project_id: true })
353
+ .extend({
354
+ completed: z.boolean().optional(),
355
+ });
356
+ /**
357
+ * Project Worker schema
358
+ */
359
+ export const ProjectWorkerSchema = z.object({
360
+ id: z.number(),
361
+ project_id: z.number(),
362
+ employee_id: z.number(),
363
+ company_labor_cost_cents: z.number().nullable(),
364
+ created_at: z.string().nullable(),
365
+ updated_at: z.string().nullable(),
366
+ });
367
+ /**
368
+ * Project Worker assign input schema
369
+ */
370
+ export const AssignProjectWorkerInputSchema = z.object({
371
+ project_id: z.number().positive(),
372
+ employee_id: z.number().positive(),
373
+ });
374
+ /**
375
+ * Time Record schema
376
+ */
377
+ export const TimeRecordSchema = z.object({
378
+ id: z.number(),
379
+ project_worker_id: z.number(),
380
+ subproject_id: z.number().nullable(),
381
+ attendance_shift_id: z.number().nullable(),
382
+ minutes: z.number(),
383
+ date: z.string(),
384
+ description: z.string().nullable(),
385
+ created_at: z.string().nullable(),
386
+ updated_at: z.string().nullable(),
387
+ });
388
+ /**
389
+ * Time Record create input schema
390
+ */
391
+ export const CreateTimeRecordInputSchema = z.object({
392
+ project_worker_id: z.number().positive(),
393
+ date: dateString,
394
+ minutes: z.number().min(1).max(1440),
395
+ description: z.string().max(500).optional(),
396
+ });
397
+ /**
398
+ * Time Record update input schema
399
+ */
400
+ export const UpdateTimeRecordInputSchema = CreateTimeRecordInputSchema.partial().omit({
401
+ project_worker_id: true,
402
+ });
403
+ /**
404
+ * Training schema
405
+ */
406
+ export const TrainingSchema = z.object({
407
+ id: z.number(),
408
+ name: z.string(),
409
+ description: z.string().nullable(),
410
+ category_id: z.number().nullable(),
411
+ status: z.string().nullable(),
412
+ subsidized: z.boolean().nullable(),
413
+ total_training_indirect_cost: z.number().nullable(),
414
+ total_training_salary_cost: z.number().nullable(),
415
+ company_id: z.number().nullable(),
416
+ created_at: z.string().nullable(),
417
+ updated_at: z.string().nullable(),
418
+ });
419
+ /**
420
+ * Training create input schema
421
+ */
422
+ export const CreateTrainingInputSchema = z.object({
423
+ name: z.string().min(1).max(100),
424
+ description: z.string().max(1000).optional(),
425
+ category_id: z.number().positive().optional(),
426
+ subsidized: z.boolean().optional(),
427
+ });
428
+ /**
429
+ * Training update input schema
430
+ */
431
+ export const UpdateTrainingInputSchema = CreateTrainingInputSchema.partial();
432
+ /**
433
+ * Training Session schema
434
+ */
435
+ export const TrainingSessionSchema = z.object({
436
+ id: z.number(),
437
+ training_id: z.number(),
438
+ name: z.string().nullable(),
439
+ start_date: z.string().nullable(),
440
+ end_date: z.string().nullable(),
441
+ location: z.string().nullable(),
442
+ max_attendees: z.number().nullable(),
443
+ created_at: z.string().nullable(),
444
+ updated_at: z.string().nullable(),
445
+ });
446
+ /**
447
+ * Training Session create input schema
448
+ */
449
+ export const CreateTrainingSessionInputSchema = z.object({
450
+ training_id: z.number().positive(),
451
+ name: z.string().max(100).optional(),
452
+ start_date: dateString.optional(),
453
+ end_date: dateString.optional(),
454
+ location: z.string().max(200).optional(),
455
+ max_attendees: z.number().positive().optional(),
456
+ });
457
+ /**
458
+ * Training Session update input schema
459
+ */
460
+ export const UpdateTrainingSessionInputSchema = CreateTrainingSessionInputSchema.partial().omit({
461
+ training_id: true,
462
+ });
463
+ /**
464
+ * Training Membership (Enrollment) schema
465
+ */
466
+ export const TrainingMembershipSchema = z.object({
467
+ id: z.number(),
468
+ training_id: z.number(),
469
+ employee_id: z.number(),
470
+ session_id: z.number().nullable(),
471
+ status: z.string().nullable(),
472
+ enrolled_at: z.string().nullable(),
473
+ completed_at: z.string().nullable(),
474
+ created_at: z.string().nullable(),
475
+ updated_at: z.string().nullable(),
476
+ });
477
+ /**
478
+ * Training enrollment input schema
479
+ */
480
+ export const EnrollTrainingInputSchema = z.object({
481
+ training_id: z.number().positive(),
482
+ employee_id: z.number().positive(),
483
+ session_id: z.number().positive().optional(),
484
+ });
485
+ /**
486
+ * Work Area schema
487
+ */
488
+ export const WorkAreaSchema = z.object({
489
+ id: z.number(),
490
+ name: z.string(),
491
+ description: z.string().nullable(),
492
+ location_id: z.number().nullable(),
493
+ company_id: z.number().nullable(),
494
+ archived: z.boolean().default(false),
495
+ created_at: z.string().nullable(),
496
+ updated_at: z.string().nullable(),
497
+ });
498
+ /**
499
+ * Work Area create input schema
500
+ */
501
+ export const CreateWorkAreaInputSchema = z.object({
502
+ name: z.string().min(1).max(100),
503
+ description: z.string().max(500).optional(),
504
+ location_id: z.number().positive().optional(),
505
+ });
506
+ /**
507
+ * Work Area update input schema
508
+ */
509
+ export const UpdateWorkAreaInputSchema = CreateWorkAreaInputSchema.partial();
510
+ /**
511
+ * Job Posting schema
512
+ */
513
+ export const JobPostingSchema = z.object({
514
+ id: z.number(),
515
+ title: z.string(),
516
+ description: z.string().nullable(),
517
+ department: z.string().nullable(),
518
+ location_id: z.number().nullable(),
519
+ team_id: z.number().nullable(),
520
+ status: z.enum(['draft', 'published', 'closed', 'archived']).nullable(),
521
+ employment_type: z.string().nullable(),
522
+ remote_status: z.string().nullable(),
523
+ company_id: z.number().nullable(),
524
+ published_at: z.string().nullable(),
525
+ closed_at: z.string().nullable(),
526
+ created_at: z.string().nullable(),
527
+ updated_at: z.string().nullable(),
528
+ });
529
+ /**
530
+ * Job Posting create input schema
531
+ */
532
+ export const CreateJobPostingInputSchema = z.object({
533
+ title: z.string().min(1).max(200),
534
+ description: z.string().max(5000).optional(),
535
+ department: z.string().max(100).optional(),
536
+ location_id: z.number().positive().optional(),
537
+ team_id: z.number().positive().optional(),
538
+ employment_type: z.string().max(50).optional(),
539
+ remote_status: z.string().max(50).optional(),
540
+ });
541
+ /**
542
+ * Job Posting update input schema
543
+ */
544
+ export const UpdateJobPostingInputSchema = CreateJobPostingInputSchema.partial().extend({
545
+ status: z.enum(['draft', 'published', 'closed', 'archived']).optional(),
546
+ });
547
+ /**
548
+ * Candidate schema
549
+ */
550
+ export const CandidateSchema = z.object({
551
+ id: z.number(),
552
+ first_name: z.string().nullable(),
553
+ last_name: z.string().nullable(),
554
+ full_name: z.string().nullable(),
555
+ email: z.string().nullable(),
556
+ phone: z.string().nullable(),
557
+ source: z.string().nullable(),
558
+ resume_url: z.string().nullable(),
559
+ linkedin_url: z.string().nullable(),
560
+ company_id: z.number().nullable(),
561
+ created_at: z.string().nullable(),
562
+ updated_at: z.string().nullable(),
563
+ });
564
+ /**
565
+ * Candidate create input schema
566
+ */
567
+ export const CreateCandidateInputSchema = z.object({
568
+ first_name: z.string().min(1).max(100),
569
+ last_name: z.string().min(1).max(100),
570
+ email: z.string().email().optional(),
571
+ phone: z.string().max(30).optional(),
572
+ source: z.string().max(100).optional(),
573
+ linkedin_url: z.string().url().optional(),
574
+ });
575
+ /**
576
+ * Candidate update input schema
577
+ */
578
+ export const UpdateCandidateInputSchema = CreateCandidateInputSchema.partial();
579
+ /**
580
+ * Application schema
581
+ */
582
+ export const ApplicationSchema = z.object({
583
+ id: z.number(),
584
+ job_posting_id: z.number(),
585
+ candidate_id: z.number(),
586
+ hiring_stage_id: z.number().nullable(),
587
+ ats_application_phase_id: z.number().nullable(),
588
+ status: z.string().nullable(),
589
+ rating: z.number().nullable(),
590
+ notes: z.string().nullable(),
591
+ applied_at: z.string().nullable(),
592
+ rejected_at: z.string().nullable(),
593
+ hired_at: z.string().nullable(),
594
+ created_at: z.string().nullable(),
595
+ updated_at: z.string().nullable(),
596
+ });
597
+ /**
598
+ * Application create input schema
599
+ */
600
+ export const CreateApplicationInputSchema = z.object({
601
+ job_posting_id: z.number().positive(),
602
+ candidate_id: z.number().positive(),
603
+ notes: z.string().max(2000).optional(),
604
+ });
605
+ /**
606
+ * Application update input schema
607
+ */
608
+ export const UpdateApplicationInputSchema = z.object({
609
+ hiring_stage_id: z.number().positive().optional(),
610
+ rating: z.number().min(0).max(5).optional(),
611
+ notes: z.string().max(2000).optional(),
612
+ });
613
+ /**
614
+ * Hiring Stage schema
615
+ */
616
+ export const HiringStageSchema = z.object({
617
+ id: z.number(),
618
+ name: z.string(),
619
+ label: z.string().nullable(),
620
+ ats_application_phase_id: z.number().nullable(),
621
+ position: z.number().nullable(),
622
+ company_id: z.number().nullable(),
623
+ created_at: z.string().nullable(),
624
+ updated_at: z.string().nullable(),
625
+ });
626
+ /**
627
+ * Payroll Supplement schema
628
+ */
629
+ export const PayrollSupplementSchema = z.object({
630
+ id: z.number(),
631
+ employee_id: z.number(),
632
+ supplement_type_id: z.number().nullable(),
633
+ name: z.string().nullable(),
634
+ amount_cents: z.number().nullable(),
635
+ effective_on: z.string().nullable(),
636
+ company_id: z.number().nullable(),
637
+ created_at: z.string().nullable(),
638
+ updated_at: z.string().nullable(),
639
+ });
640
+ /**
641
+ * Tax Identifier schema
642
+ */
643
+ export const TaxIdentifierSchema = z.object({
644
+ id: z.number(),
645
+ employee_id: z.number(),
646
+ identifier_type: z.string().nullable(),
647
+ identifier_value: z.string().nullable(),
648
+ country: z.string().nullable(),
649
+ created_at: z.string().nullable(),
650
+ updated_at: z.string().nullable(),
651
+ });
652
+ /**
653
+ * Family Situation schema
654
+ */
655
+ export const FamilySituationSchema = z.object({
656
+ id: z.number(),
657
+ employee_id: z.number(),
658
+ marital_status: z.string().nullable(),
659
+ number_of_dependents: z.number().nullable(),
660
+ effective_on: z.string().nullable(),
661
+ created_at: z.string().nullable(),
662
+ updated_at: z.string().nullable(),
663
+ });
664
+ // ============================================================================
665
+ // API Response Helpers
666
+ // ============================================================================
667
+ /**
668
+ * API response wrapper schema
669
+ */
670
+ export function createApiResponseSchema(dataSchema) {
671
+ return z.object({
672
+ data: dataSchema,
673
+ });
674
+ }
675
+ /**
676
+ * API list response wrapper schema
677
+ */
678
+ export function createApiListResponseSchema(itemSchema) {
679
+ return z.object({
680
+ data: z.array(itemSchema),
681
+ });
682
+ }
683
+ /**
684
+ * Parse and validate data against a schema
685
+ * @throws SchemaValidationError if validation fails
686
+ */
687
+ export function parseData(schemaName, schema, data) {
688
+ const result = schema.safeParse(data);
689
+ if (!result.success) {
690
+ const issues = result.error.issues.map(i => `${i.path.join('.')}: ${i.message}`).join(', ');
691
+ throw new SchemaValidationError(schemaName, issues, { data });
692
+ }
693
+ return result.data;
694
+ }
695
+ /**
696
+ * Safely parse data without throwing (returns undefined on failure)
697
+ */
698
+ export function safeParseData(schema, data) {
699
+ const result = schema.safeParse(data);
700
+ return result.success ? result.data : undefined;
701
+ }
702
+ /**
703
+ * Parse an array of items against a schema
704
+ */
705
+ export function parseArray(schemaName, itemSchema, data) {
706
+ if (!Array.isArray(data)) {
707
+ throw new SchemaValidationError(schemaName, 'Expected an array', { data });
708
+ }
709
+ return data.map((item, index) => {
710
+ const result = itemSchema.safeParse(item);
711
+ if (!result.success) {
712
+ const issues = result.error.issues.map(i => `${i.path.join('.')}: ${i.message}`).join(', ');
713
+ throw new SchemaValidationError(`${schemaName}[${index}]`, issues, { item });
714
+ }
715
+ return result.data;
716
+ });
717
+ }
718
+ //# sourceMappingURL=schemas.js.map