import type { WorkshopEvidenceValidationStatus, WorkshopProgressStatus } from "@prisma/client";

export type MaturityLevelKey = "inicial" | "en_desarrollo" | "preparado" | "avanzado";

export type GapLevelKey = "alta" | "media" | "baja";

export type MaturityLevelView = {
  key: MaturityLevelKey;
  label: string;
  minScore: number;
  maxScore: number;
};

export type NextMaturityTarget = {
  label: MaturityLevelView["label"];
  threshold: number;
  pointsNeeded: number;
  progressToTarget: number;
} | null;

export type DimensionSnapshot = {
  moduleId: string;
  moduleKey: string;
  moduleName: string;
  baseScore: number;
  displayScore: number;
  completion: number;
  gapLevel: GapLevelKey;
  gapLabel: string;
  riskMessage: string;
  workshopCount: number;
  approvedWorkshopCount: number;
};

export type WorkshopEvidenceView = {
  id: string;
  validationStatus: WorkshopEvidenceValidationStatus;
  validationReason: string | null;
  validationConfidence: number | null;
  fileName: string;
  mimeType: string;
  createdAt: string;
};

export type WorkshopView = {
  id: string;
  key: string;
  moduleId: string;
  moduleKey: string;
  moduleName: string;
  title: string;
  summary: string;
  videoUrl: string;
  durationMinutes: number;
  evidenceRequired: string;
  learningObjectives: string[];
  status: WorkshopProgressStatus;
  latestEvidence: WorkshopEvidenceView | null;
};

export type StrategicRecommendationView = {
  id: string;
  title: string;
  description: string;
  moduleKey: string;
  moduleName: string;
  priority: "alta" | "media";
};

export type TalleresSnapshot = {
  generatedAt: string;
  overallMaturity: number;
  maturityLevel: MaturityLevelView;
  nextLevel: NextMaturityTarget;
  dimensions: DimensionSnapshot[];
  workshopsByDimension: Record<string, WorkshopView[]>;
  recommendations: StrategicRecommendationView[];
  summary: {
    dimensionsWithGap: number;
    currentScore: number;
    targetScore: number;
    totalWorkshops: number;
    approvedWorkshops: number;
  };
};
