{"$schema":"https://json-schema.org/draft/2020-12/schema","$id":"/api/v1/plan-schema","title":"Workout Relay running plan","type":"object","additionalProperties":false,"required":["schema_version","plan_id","title","workouts"],"properties":{"schema_version":{"const":1},"plan_id":{"type":"string","pattern":"^[a-zA-Z0-9][a-zA-Z0-9_-]{2,99}$"},"title":{"type":"string","minLength":1,"maxLength":120},"description":{"type":"string","maxLength":1000},"workouts":{"type":"array","minItems":1,"maxItems":31,"items":{"$ref":"#/$defs/workout"}}},"$defs":{"workout":{"type":"object","additionalProperties":false,"required":["id","date","sport","title","steps"],"properties":{"id":{"type":"string","pattern":"^[a-z0-9][a-z0-9_-]{1,159}$","description":"Stable workout identity across this account. Keep unchanged when rescheduling."},"date":{"type":"string","format":"date"},"sport":{"const":"running"},"title":{"type":"string","minLength":1,"maxLength":50},"description":{"type":"string","maxLength":500},"estimated_duration_sec":{"type":"integer","minimum":1,"maximum":86400},"steps":{"type":"array","minItems":1,"maxItems":50,"items":{"$ref":"#/$defs/step"}}}},"step":{"oneOf":[{"$ref":"#/$defs/simpleStep"},{"$ref":"#/$defs/repeatStep"}]},"simpleStep":{"type":"object","additionalProperties":false,"required":["type","duration","target"],"properties":{"type":{"enum":["warmup","interval","recovery","cooldown"]},"name":{"type":"string","maxLength":80},"duration":{"$ref":"#/$defs/duration"},"target":{"$ref":"#/$defs/target"}}},"repeatStep":{"type":"object","additionalProperties":false,"required":["type","count","steps"],"properties":{"type":{"const":"repeat"},"name":{"type":"string","maxLength":80},"count":{"type":"integer","minimum":1,"maximum":50},"steps":{"type":"array","minItems":1,"maxItems":5,"items":{"$ref":"#/$defs/simpleStep"}}}},"duration":{"oneOf":[{"type":"object","additionalProperties":false,"required":["type","value"],"properties":{"type":{"const":"time"},"value":{"type":"integer","minimum":1,"maximum":86400}}},{"type":"object","additionalProperties":false,"required":["type","value"],"properties":{"type":{"const":"distance"},"value":{"type":"integer","minimum":1,"maximum":500000}}}]},"target":{"oneOf":[{"type":"object","additionalProperties":false,"required":["type"],"properties":{"type":{"const":"no_target"}}},{"type":"object","additionalProperties":false,"required":["type","low","high"],"properties":{"type":{"const":"heart_rate"},"low":{"type":"integer","minimum":30,"maximum":250},"high":{"type":"integer","minimum":30,"maximum":250}}},{"type":"object","additionalProperties":false,"required":["type","slow","fast"],"properties":{"type":{"const":"pace"},"slow":{"type":"string","pattern":"^[2-9]:[0-5][0-9]$"},"fast":{"type":"string","pattern":"^[2-9]:[0-5][0-9]$"}}}]}}}