import type { FastifyRequest, FastifyReply } from 'fastify';
import * as dashboardService from '../services/dashboard.service.js';

export async function kpiHandler(_request: FastifyRequest, _reply: FastifyReply) {
  const data = await dashboardService.kpi();
  return { data };
}

export async function monthlyOrdersHandler(_request: FastifyRequest, _reply: FastifyReply) {
  const data = await dashboardService.monthlyOrders();
  return { data };
}

export async function recentOrdersHandler(_request: FastifyRequest, _reply: FastifyReply) {
  const data = await dashboardService.recentOrders();
  return { data };
}

export async function ordersOverviewHandler(_request: FastifyRequest, _reply: FastifyReply) {
  const data = await dashboardService.ordersOverview();
  return { data };
}

export async function monthlyProductionHandler(_request: FastifyRequest, _reply: FastifyReply) {
  const data = await dashboardService.monthlyProduction();
  return { data };
}

export async function dispatchAnalysisHandler(_request: FastifyRequest, _reply: FastifyReply) {
  const data = await dashboardService.dispatchAnalysis();
  return { data };
}

export async function stageBreakdownHandler(_request: FastifyRequest, _reply: FastifyReply) {
  const data = await dashboardService.stageBreakdown();
  return { data };
}

export async function stageNamesHandler(_request: FastifyRequest, _reply: FastifyReply) {
  const data = await dashboardService.stageNames();
  return { data };
}

export async function stageIdleSummaryHandler(_request: FastifyRequest, _reply: FastifyReply) {
  const data = await dashboardService.stageIdleSummary();
  return { data };
}

export async function clientNamesHandler(_request: FastifyRequest, _reply: FastifyReply) {
  const data = await dashboardService.clientNames();
  return { data };
}

export async function wireSizesByProductHandler(_request: FastifyRequest, _reply: FastifyReply) {
  const data = await dashboardService.wireSizesByProduct();
  return { data };
}
