/**
 * cli:scaffold-extension-config — types.ts
 *
 * Slot name format: `{module}.{entity}.{view}.{position}` where each segment is
 * kebab-case. Deviating from this pattern breaks runtime slot resolution.
 */
import { z } from 'zod'

const SEGMENT_REGEX = /^[a-z][a-z0-9]*(-[a-z0-9]+)*$/

export const ScaffoldExtensionConfigInputSchema = z.object({
  module: z.string().min(1).regex(SEGMENT_REGEX, 'module must be kebab-case'),
  appCode: z.string().min(1).regex(SEGMENT_REGEX, 'appCode must be kebab-case'),
  entities: z.array(z.string().min(1).regex(/^[A-Z][A-Za-z0-9]*$/, 'entities must be PascalCase')).min(1),
  projectPath: z.string().min(1),
})

export type ScaffoldExtensionConfigInput = z.infer<typeof ScaffoldExtensionConfigInputSchema>
export interface GeneratedFile {
  path: string
  content: string
}
export interface ValidationResult {
  valid: boolean
  errors: string[]
  warnings: string[]
}
