import { z } from "zod";
/**
* Task status enum
*/
export enum TaskStatus {
PENDING = "pending",
COMPLETED = "completed",
}
/**
* Zod schema for Task
*/
export const TaskSchema = z.object({
id: z.string().describe("Unique task identifier"),
title: z.string().min(1).describe("Task title"),
description: z.string().optional().describe("Optional task description"),
status: z.nativeEnum(TaskStatus).describe("Current status of the task"),
createdAt: z.date().describe("When the task was created"),
completedAt: z.date().optional().describe("When the task was completed"),
});
/**
* Task interface derived from Zod schema
*/
export type Task = z.infer<typeof TaskSchema>;
/**
* Input for creating a new task
*/
export const CreateTaskInputSchema = z
.object({
title: z
.string()
.min(1, "Title is required")
.max(200, "Title must not exceed 200 characters")
.describe("Task title"),
description: z
.string()
.max(1000, "Description must not exceed 1000 characters")
.optional()
.describe("Optional task description"),
})
.strict();
export type CreateTaskInput = z.infer<typeof CreateTaskInputSchema>;
/**
* Input for completing a task
*/
export const CompleteTaskInputSchema = z
.object({
id: z.string().min(1, "Task ID is required").describe("Task ID to complete"),
})
.strict();
export type CompleteTaskInput = z.infer<typeof CompleteTaskInputSchema>;
/**
* Input for deleting a task
*/
export const DeleteTaskInputSchema = z
.object({
id: z.string().min(1, "Task ID is required").describe("Task ID to delete"),
})
.strict();
export type DeleteTaskInput = z.infer<typeof DeleteTaskInputSchema>;
/**
* Response format enum
*/
export enum ResponseFormat {
MARKDOWN = "markdown",
JSON = "json",
}
/**
* Input for listing tasks
*/
export const ListTasksInputSchema = z
.object({
status: z
.nativeEnum(TaskStatus)
.optional()
.describe("Filter by task status"),
response_format: z
.nativeEnum(ResponseFormat)
.default(ResponseFormat.MARKDOWN)
.describe("Output format: 'markdown' or 'json'"),
})
.strict();
export type ListTasksInput = z.infer<typeof ListTasksInputSchema>;