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

import { z } from 'zod';

export const StartSpecSchema = z.object({
  type: z.enum(['feature', 'release', 'hotfix']),
  name: z.string(),
  noPush: z.boolean().optional().default(false),
  dryRun: z.boolean().optional().default(false),
});

export type StartSpec = z.infer<typeof StartSpecSchema>;

export const StartResultSchema = z.object({
  success: z.boolean(),
  error: z.string().optional(),
  branch: z.string(),
  branchType: z.enum(['feature', 'release', 'hotfix']),
  baseBranch: z.string(),
  worktreePath: z.string().optional(),
  pushed: z.boolean(),
  /** Release/hotfix only: the version materialized in the sources on the branch. */
  version: z.string().optional(),
  /** True when a `chore: set version to X` commit was made on the new branch. */
  versionSet: z.boolean().optional(),
  warnings: z.array(z.string()).optional(),
});

export type StartResult = z.infer<typeof StartResultSchema>;
