import { registry } from "../../infrastructure/openapi/registry";
import { z } from "zod";
import { ErrorResponseSchema } from "../../infrastructure/openapi/security";

const EmployeeDashboardResponseSchema = registry.register(
  "EmployeeDashboardResponse",
  z.object({
    success: z.boolean().default(true),
    statusCode: z.number().default(200),
    message: z.string().optional(),
    data: z.any().optional(),
  }),
);

registry.registerPath({
  method: "get",
  path: "/employee-dashboard/tasks/stats",
  summary: "Get task statistics for the logged-in employee",
  tags: ["Employee Dashboard"],
  security: [{ bearerAuth: [] }],
  responses: {
    200: {
      description: "Task stats fetched successfully",
      content: {
        "application/json": { schema: EmployeeDashboardResponseSchema },
      },
    },
    400: {
      description: "Employee profile not found",
      content: { "application/json": { schema: ErrorResponseSchema } },
    },
    401: {
      description: "Unauthorized",
      content: { "application/json": { schema: ErrorResponseSchema } },
    },
  },
});

registry.registerPath({
  method: "get",
  path: "/employee-dashboard/tasks/trend",
  summary: "Get task assignment/completion trend for the logged-in employee",
  tags: ["Employee Dashboard"],
  security: [{ bearerAuth: [] }],
  request: {
    query: z.object({
      days: z
        .string()
        .optional()
        .describe("Number of days to include in the trend (default: 30)"),
    }),
  },
  responses: {
    200: {
      description: "Task trend fetched successfully",
      content: {
        "application/json": { schema: EmployeeDashboardResponseSchema },
      },
    },
    400: {
      description: "Employee profile not found",
      content: { "application/json": { schema: ErrorResponseSchema } },
    },
    401: {
      description: "Unauthorized",
      content: { "application/json": { schema: ErrorResponseSchema } },
    },
  },
});
