import { listTasks, taskSchema } from "../../data/index.js";
import { authenticate } from "../authentication.js";
import { isUnauthenticated } from "../../authentication/index.js";
export async function listTaskRoutes(fastify) {
    const response = {
        200: {
            type: "array",
            items: taskSchema.task,
        },
    };
    const schema = {
        description: "List of tasks",
        tags: ["task"],
        summary: "",
        response,
        security: [
            {
                apiKey: [],
            },
        ],
    };
    try {
        fastify.get("/", {
            schema,
            preHandler: authenticate(fastify, { anonymous: true }),
            async handler(request, response) {
                response.send(await listTasks({
                    public: isUnauthenticated()
                }));
            },
        });
    }
    catch { }
}
//# sourceMappingURL=list-tasks.js.map