import { z } from 'zod'

// ─── Input Options ───────────────────────────────────────────────────────

export const MergeOptionsSchema = z.object({
  squash: z.boolean().optional(),
  merge: z.boolean().optional(),
})

// ─── Result ───────────────────────────────────────────────────────────

export const MergeResultSchema = z.object({
  success: z.boolean(),
  prNumber: z.number().optional(),
  strategy: z.enum(['squash', 'merge']),
  target: z.string(),
  branchDeleted: z.boolean(),
  /** Local develop was verified aligned with origin BEFORE the merge (the rule). */
  developAligned: z.boolean().optional(),
  /** Local develop was fast-forwarded to the merged origin/develop AFTER the merge. */
  developSynced: z.boolean().optional(),
  warnings: z.array(z.string()).optional(),
  error: z.string().optional(),
})

// ─── Inferred Types ───────────────────────────────────────────────────────

export type MergeOptions = z.infer<typeof MergeOptionsSchema>
export type MergeResult = z.infer<typeof MergeResultSchema>
