/**
 * commit CLI types — Input spec and output result
 */

import { z } from 'zod';
import type { EfCoreValidation } from '../lib/types.js';

export const CommitSpecSchema = z.object({
  message: z.string().optional(),
  push: z.boolean().optional().default(false),
  noEfcore: z.boolean().optional().default(false),
});

export type CommitSpec = z.infer<typeof CommitSpecSchema>;

export const CommitResultSchema = z.object({
  success: z.boolean(),
  error: z.string().optional(),
  branch: z.string(),
  commit: z.object({
    hash: z.string(),
    message: z.string(),
  }).optional(),
  filesChanged: z.number(),
  efcore: z.object({
    detected: z.boolean(),
    valid: z.boolean(),
    destructive: z.boolean(),
    migrations: z.array(z.string()),
    missing: z.array(z.string()),
    destructiveOps: z.array(z.string()),
  }).optional(),
  pushed: z.boolean(),
});

export type CommitResult = z.infer<typeof CommitResultSchema>;
