import { z } from 'zod';

export const SystemMetricsSchema = z.object({
  timestamp: z.string(),
  uptime: z.string(),
  cpu: z.object({
    usage: z.number(),
    cores: z.number(),
    loadAverage: z.array(z.number()),
  }),
  memory: z.object({
    total: z.number(),
    used: z.number(),
    free: z.number(),
    percentage: z.number(),
  }),
  disk: z.array(z.object({
    path: z.string(),
    total: z.number(),
    used: z.number(),
    free: z.number(),
    percentage: z.number(),
  })),
  platform: z.object({
    nodeVersion: z.string(),
    platform: z.string(),
    arch: z.string(),
    hostname: z.string(),
  }),
});

export type SystemMetrics = z.infer<typeof SystemMetricsSchema>;

export const DockerCleanupParamsSchema = z.object({
  type: z.enum(['images', 'containers', 'volumes', 'all']),
  force: z.boolean().default(false),
});

export type DockerCleanupParams = z.infer<typeof DockerCleanupParamsSchema>;

export const DockerStatsSchema = z.object({
  images: z.object({
    total: z.number(),
    dangling: z.number(),
    size: z.number(),
  }),
  containers: z.object({
    total: z.number(),
    running: z.number(),
    stopped: z.number(),
    size: z.number(),
  }),
  volumes: z.object({
    total: z.number(),
    unused: z.number(),
    size: z.number(),
  }),
});

export type DockerStats = z.infer<typeof DockerStatsSchema>;
