import { z } from 'zod';
// Analysis schemas for structured Claude output
export const AnalysisStrengthSchema = z.object({
    title: z.string(),
    description: z.string(),
    impact: z.enum(['low', 'medium', 'high']),
    evidence: z.array(z.string()).optional()
});
export const AnalysisWeaknessSchema = z.object({
    title: z.string(),
    description: z.string(),
    severity: z.enum(['low', 'medium', 'high']),
    affected_areas: z.array(z.string()).optional(),
    improvement_effort: z.enum(['minimal', 'moderate', 'significant']).optional()
});
export const AnalysisRiskSchema = z.object({
    title: z.string(),
    description: z.string(),
    probability: z.enum(['low', 'medium', 'high']),
    impact: z.enum(['low', 'medium', 'high']),
    mitigation_strategy: z.string().optional()
});
export const AnalysisOpportunitySchema = z.object({
    title: z.string(),
    description: z.string(),
    potential_value: z.enum(['low', 'medium', 'high']),
    implementation_complexity: z.enum(['simple', 'moderate', 'complex']).optional()
});
export const ScoreWithReasoningSchema = z.object({
    score: z.number().min(0).max(100),
    reasoning: z.string()
});
export const RecommendationSchema = z.object({
    id: z.string(),
    category: z.enum(['requirements', 'architecture', 'security', 'performance', 'maintainability', 'testing']),
    title: z.string(),
    description: z.string(),
    implementation_guide: z.string().optional(),
    priority: z.enum(['low', 'medium', 'high', 'critical']),
    estimated_effort: z.string().optional(),
    business_impact: z.string().optional(),
    technical_complexity: z.enum(['simple', 'moderate', 'complex']).optional()
});
export const ExplicitRequirementSchema = z.object({
    requirement: z.string(),
    source_text: z.string(),
    confidence: z.enum(['high', 'medium', 'low'])
});
export const InferredRequirementSchema = z.object({
    requirement: z.string(),
    rationale: z.string(),
    domain_pattern: z.string(),
    priority: z.enum(['critical', 'high', 'medium', 'low'])
});
export const NonFunctionalRequirementSchema = z.object({
    category: z.string(),
    requirement: z.string(),
    industry_standard: z.boolean(),
    customization_needed: z.boolean()
});
export const ClarificationQuestionSchema = z.object({
    category: z.string(),
    question: z.string(),
    impact_if_unclear: z.string(),
    suggested_default: z.string()
});
export const SuggestedProductRequirementsSchema = z.object({
    explicit_requirements: z.array(ExplicitRequirementSchema),
    inferred_functional_requirements: z.array(InferredRequirementSchema),
    suggested_non_functional_requirements: z.array(NonFunctionalRequirementSchema),
    requirements_clarification_questions: z.array(ClarificationQuestionSchema)
});
// Feature Gap Analysis schemas
export const FeatureGapSchema = z.object({
    feature: z.string(),
    priority: z.enum(['critical', 'high', 'medium', 'low']),
    rationale: z.string(),
    suggested_approach: z.string(),
    estimated_effort: z.string()
});
export const MissingNonFunctionalRequirementSchema = z.object({
    requirement: z.string(),
    category: z.enum(['security', 'performance', 'accessibility', 'monitoring', 'documentation', 'testing', 'deployment']),
    impact: z.string(),
    recommendation: z.string()
});
export const FeatureGapAnalysisSchema = z.object({
    missing_core_features: z.array(FeatureGapSchema),
    missing_non_functional_requirements: z.array(MissingNonFunctionalRequirementSchema)
});
// Timeline schema for implementation plans
export const TimelinePhaseSchema = z.object({
    id: z.string(),
    name: z.string(),
    description: z.string(),
    duration_weeks: z.number(),
    start_week: z.number(),
    dependencies: z.array(z.string()).optional(),
    deliverables: z.array(z.string()).optional(),
    key_milestones: z.array(z.string()).optional(),
    resources_required: z.array(z.string()).optional(),
    risks: z.array(z.string()).optional()
});
export const TimelineSchema = z.object({
    total_duration_weeks: z.number(),
    phases: z.array(TimelinePhaseSchema)
});
export const ProjectAnalysisSchema = z.object({
    project_id: z.string(),
    analysis_type: z.enum(['project_review', 'development_plan', 'story_implementation']),
    executive_summary: z.string(),
    analysis: z.object({
        strengths: z.array(AnalysisStrengthSchema),
        weaknesses: z.array(AnalysisWeaknessSchema),
        risks: z.array(AnalysisRiskSchema),
        opportunities: z.array(AnalysisOpportunitySchema)
    }),
    scores: z.object({
        completeness: ScoreWithReasoningSchema,
        clarity: ScoreWithReasoningSchema,
        feasibility: ScoreWithReasoningSchema,
        overall: ScoreWithReasoningSchema
    }),
    recommendations: z.array(RecommendationSchema),
    suggested_product_requirements: SuggestedProductRequirementsSchema,
    feature_gap_analysis: FeatureGapAnalysisSchema.optional(),
    metadata: z.object({
        analysis_duration_seconds: z.number(),
        claude_model: z.string(),
        confidence_level: z.number().min(0).max(1),
        analysis_timestamp: z.string(),
        reviewer_notes: z.string().optional()
    })
});
// Extended schema for implementation plans with timeline
export const ImplementationPlanSchema = ProjectAnalysisSchema.extend({
    analysis_type: z.literal('implementation_plan'),
    timeline: TimelineSchema
});
