import { z } from 'zod'

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

export const PrOptionsSchema = z.object({
  draft: z.boolean().optional().default(false),
})

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

export const PrResultSchema = z.object({
  success: z.boolean(),
  provider: z.string(),
  prNumber: z.number().optional(),
  prUrl: z.string().optional(),
  title: z.string(),
  source: z.string(),
  target: z.string(),
  draft: z.boolean(),
  buildPassed: z.boolean().optional(),
  /** Local develop was verified aligned with origin BEFORE opening the PR (the rule). */
  developAligned: z.boolean().optional(),
  warnings: z.array(z.string()).optional(),
  error: z.string().optional(),
})

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

export type PrOptions = z.infer<typeof PrOptionsSchema>
export type PrResult = z.infer<typeof PrResultSchema>
