/** * Compact Training Plan Schema * * A minimal schema for AI models to generate training plans. * The compact format is expanded to the full format for HTML rendering. * * Key design principles: * - Minimal output for models to generate * - Template references instead of full workout definitions * - Athlete paces/zones as inputs, system calculates ranges */ export type Sport = "swim" | "bike" | "run" | "strength" | "brick"; export type FirstDayOfWeek = "monday" | "sunday"; export type DistanceUnit = "km" | "mi"; /** * Athlete's pace values for different workout intensities. * Models specify these once, templates interpolate them. */ export interface AthletePaces { easy?: string; long?: string; tempo?: string; threshold?: string; marathon?: string; halfMarathon?: string; interval?: string; r200?: string; r400?: string; r800?: string; r1k?: string; rMile?: string; bikeFtp?: number; bikeEasy?: string; bikeTempo?: string; bikeThreshold?: string; swimCss?: string; swimEasy?: string; swimTempo?: string; } /** * Heart rate zone configuration. * Only LTHR required - zone ranges are calculated automatically. */ export interface HRZoneConfig { lthr: number; maxHR?: number; restingHR?: number; } /** * Athlete's training zones. * Minimal input, system calculates full zone ranges. */ export interface AthleteZones { hr?: HRZoneConfig; } /** * Athlete preferences and constraints. */ export interface AthleteConstraints { daysPerWeek?: number | string; preferredDays?: string[]; maxLongRunHours?: number; maxLongBikeHours?: number; notes?: string[]; } /** * Complete athlete configuration in compact format. */ export interface CompactAthlete { name: string; event: string; eventDate: string; startDate?: string; paces: AthletePaces; zones?: AthleteZones; constraints?: AthleteConstraints; unit?: DistanceUnit; firstDayOfWeek?: FirstDayOfWeek; } /** * Strength or limiter entry in the assessment. */ export interface CompactAssessmentEntry { sport: Sport; evidence: string; } /** * Athlete assessment for context on their training background. */ export interface CompactAssessment { foundation?: { raceHistory?: string[]; peakTrainingLoad?: number; foundationLevel?: "beginner" | "intermediate" | "advanced" | "elite"; yearsInSport?: number; }; currentForm?: { weeklyVolume?: { total?: number; swim?: number; bike?: number; run?: number; }; longestSessions?: { swim?: number; bike?: number; run?: number; }; consistency?: number; }; strengths?: CompactAssessmentEntry[]; limiters?: CompactAssessmentEntry[]; constraints?: string[]; } /** * A training phase defines a block of focused training. * Weeks can be a range string or array of week numbers. */ export interface CompactPhase { name: string; weeks: string | number[]; focus: string; keyWorkouts?: string[]; } /** * A workout reference is a template ID with optional parameters. * * Format: "template.id" or "template.id(param)" or "template.id(param1, param2)" * * Examples: * - "run.easy(30)" → easy run, 30 minutes * - "run.intervals.400(6)" → 6x400m intervals * - "run.long(90)" → 90-minute long run * - "run.rest" → rest day (no params) * - "run.tempo(20)" → 20-minute tempo section */ export type WorkoutRef = string; /** * Day of the week as used in the schedule. */ export type DayOfWeek = "Mon" | "Tue" | "Wed" | "Thu" | "Fri" | "Sat" | "Sun"; /** * A week's workout schedule maps days to workout references. * Days without workouts are implicitly rest days. */ export interface CompactWeekSchedule { [day: string]: WorkoutRef | WorkoutRef[]; } /** * A training week in the compact format. */ export interface CompactWeek { week: number; phase: string; focus?: string; isRecoveryWeek?: boolean; targetHours?: number; workouts: CompactWeekSchedule; } /** * Simplified race strategy for the compact format. */ export interface CompactRaceStrategy { goalTime?: string; pacing?: { swim?: string; bike?: string; run?: string; }; nutrition?: string; notes?: string[]; } /** * The complete compact training plan. * * This is what AI models generate. It's transformed to the full * expanded format for HTML rendering and device export. */ export interface CompactPlan { version: "2.0"; athlete: CompactAthlete; assessment?: CompactAssessment; phases: CompactPhase[]; weeks: CompactWeek[]; raceStrategy?: CompactRaceStrategy; } /** * Parsed workout reference. */ export interface ParsedWorkoutRef { templateId: string; params: (string | number)[]; } /** * Regex pattern for matching valid workout reference format. * Template IDs can only contain letters, digits, underscores, and dots. * Format: templateId or templateId(params) */ export declare const WORKOUT_REF_PATTERN: RegExp; /** * Parse a workout reference string into its components. * * Examples: * "run.easy(30)" → { templateId: "run.easy", params: [30] } * "run.intervals.400(6)" → { templateId: "run.intervals.400", params: [6] } * "run.rest" → { templateId: "run.rest", params: [] } * "run.tempo(20, 90)" → { templateId: "run.tempo", params: [20, 90] } */ export declare function parseWorkoutRef(ref: string): ParsedWorkoutRef; /** * Parse a week range string into an array of week numbers. * * Examples: * "1-3" → [1, 2, 3] * "4-6" → [4, 5, 6] * [1, 2, 3] → [1, 2, 3] (passthrough) */ export declare function parseWeekRange(weeks: string | number[]): number[];