import { z } from 'zod';

export const statisticsItemSchema = z.object({
  name: z
    .string()
    .nullable()
    .transform((val) => val || 'Sin Información'),
  value: z.number(),
});

export const trainingStatisticsSchema = z.object({
  totalOsps: z.number(),
  totalProducers: z.number(),
  totalProducts: z.number(),
  statusDistribution: z.array(statisticsItemSchema),
  activityDistribution: z.array(statisticsItemSchema),
  typeDistribution: z.array(statisticsItemSchema),
  stateDistribution: z.array(statisticsItemSchema),
  yearDistribution: z.array(statisticsItemSchema),
});

export type TrainingStatisticsData = z.infer<typeof trainingStatisticsSchema>;

export const trainingStatisticsResponseSchema = z.object({
  message: z.string(),
  data: trainingStatisticsSchema,
});
