import { z } from 'zod'; export const ampelSchema = z.enum(['green', 'amber', 'red']); export const trendSchema = z.enum(['besser', 'gleich', 'schlechter']); export const bezugKindSchema = z.enum(['project', 'deal', 'campaign', 'allgemein']); export const todoStatusSchema = z.enum(['open', 'done', 'dropped']); export const todoInputSchema = z.object({ title: z.string().min(1).max(200), bezugKind: bezugKindSchema.optional(), bezugId: z.string().uuid().optional(), }); export type TodoInput = z.infer; export const checkInInput = z.object({ todos: z.array(todoInputSchema).min(1), date: z .string() .regex(/^\d{4}-\d{2}-\d{2}$/) .optional(), // Default: heute }); export type CheckInInput = z.infer; export const submitReflectionInput = z.object({ dayEntryId: z.string().uuid(), todos: z .array( z.object({ id: z.string().uuid(), status: todoStatusSchema, // Optionale Notiz pro Task (frühere „Verworfen-Grund"-Spalte, jetzt für // jeden Status als freie Beschreibung nutzbar). dropReason: z.string().max(500).optional(), }), ) .default([]), reflectionText: z.string().max(1000).default(''), ampel: ampelSchema, trend: trendSchema.nullable().optional(), blocker: z .object({ title: z.string().min(1).max(200), description: z.string().max(1000).optional(), }) .optional(), url: z.string().url().optional(), }); export type SubmitReflectionInput = z.infer; export const todoMutationInput = z.object({ dayEntryId: z.string().uuid(), todos: z.array(todoInputSchema).min(0), }); export type TodoMutationInput = z.infer; export const editTodoTitleInput = z.object({ todoId: z.string().uuid(), title: z.string().min(1).max(200), }); export type EditTodoTitleInput = z.infer; // Einzelnes ToDo mitten am Tag zum heutigen Tageseintrag hinzufügen. export const addTodoInput = z.object({ title: z.string().min(1).max(200), bezugKind: bezugKindSchema.optional(), bezugId: z.string().uuid().optional(), }); export type AddTodoInput = z.infer; // Ungeplant dazugekommenes & bereits erledigtes Item nachtragen (Drive-by). export const addUnplannedInput = z.object({ title: z.string().min(1).max(200), bezugKind: bezugKindSchema.optional(), bezugId: z.string().uuid().optional(), }); export type AddUnplannedInput = z.infer; export const historyForDateInput = z.object({ date: z .string() .regex(/^\d{4}-\d{2}-\d{2}$/) .optional(), // Default: vorheriger Werktag }); export type HistoryForDateInput = z.infer; export const markAbsentInput = z.object({ from: z.string().regex(/^\d{4}-\d{2}-\d{2}$/), to: z.string().regex(/^\d{4}-\d{2}-\d{2}$/), reason: z.enum(['urlaub', 'krank', 'sonstiges']), }); export type MarkAbsentInput = z.infer;