import { z } from 'zod';

export const CreateSpecSchema = z.object({
  cwd: z.string().min(1),
  contextName: z.string().min(1),
  description: z.string().min(1),
  /** Optional: target a single migration assembly (required for multi-provider contexts unless allProviders=true). */
  assembly: z.string().optional(),
  /** For multi-provider contexts (Studio), create the migration in EVERY assembly. Default: true. */
  allProviders: z.boolean().optional().default(true),
  /** Optional override of the startup project used by `dotnet ef`. */
  startupProject: z.string().optional(),
  /** Dry-run: compute name + paths, do NOT spawn dotnet. */
  dryRun: z.boolean().optional().default(false),
});
export type CreateSpec = z.infer<typeof CreateSpecSchema>;

export interface CreateAssemblyResult {
  assemblyName: string;
  migrationName: string;
  csprojPath: string;
  output: string;
  success: boolean;
  error?: string;
  filesCreated: string[];
}

export interface CreateResult {
  success: boolean;
  cwd: string;
  contextName: string;
  assemblies: CreateAssemblyResult[];
  warnings: string[];
  error?: string;
}
