import { z } from 'zod';

export const PluginIdParamsSchema = z.object({
  id: z.string().min(1).max(256),
});

export const InstallPluginSchema = z.object({
  pluginId: z.string().min(1).max(256),
});

/**
 * Response body of `POST /api/plugins/reload`.
 *
 * Mirrors `cowork_orchestrator::ReloadStats` — an atomic-swap summary of the
 * on-disk plugin registry. `errors` entries are `"{path}: {reason}"` strings
 * for plugin directories whose manifest failed to parse.
 */
export const ReloadResponseSchema = z.object({
  loaded: z.number().int().nonnegative(),
  added: z.array(z.string()),
  removed: z.array(z.string()),
  updated: z.array(z.string()),
  errors: z.array(z.string()),
});

export type ReloadResponse = z.infer<typeof ReloadResponseSchema>;
