import { listSystemLogs, systemLogSchema } from "../../data/index.js";
import { authenticate } from "../authentication.js";
import { getMaybeAuthorizedForPartnerId } from "../../authentication/index.js";
export async function listSystemLogsRoutes(fastify) {
    const response = {
        200: {
            description: "System logs",
            type: "array",
            items: {
                ...systemLogSchema.systemLog,
                additionalProperties: true,
            }
        }
    };
    const schema = {
        description: "List of system logs",
        tags: ["system"],
        summary: "",
        response,
        security: [
            {
                apiKey: []
            }
        ]
    };
    try {
        fastify.get("/", {
            schema,
            preHandler: authenticate(fastify),
            async handler(request, response) {
                const data = await listSystemLogs({
                    partnerId: getMaybeAuthorizedForPartnerId()
                });
                response.send(data);
            }
        });
    }
    catch {
    }
}
//# sourceMappingURL=list-system-logs.js.map