{
  "tool_id": "swim_pace_calculator",
  "slug": "swim-pace-calculator",
  "path": "/swim-pace-calculator/",
  "mode": "engine_module",
  "usage": "Import https://aifithub.io/engines/swim-pace-calculator.js as an ES module and call compute(input) with the fields in input_schema (every field is optional and falls back to its default). Input is validated: an unknown field, a wrong type, or a value outside enum/minimum/maximum throws an Error that names the field. The same calculator runs at https://aifithub.io/swim-pace-calculator/.",
  "methodology": "https://aifithub.io/methodology/swim-pace-calculator/",
  "sample_input": {
    "mode": "pace",
    "stroke_type": "freestyle",
    "distance_value": 1500,
    "distance_unit": "m",
    "laps": 0,
    "pool_length": 25,
    "pool_length_unit": "m",
    "time_seconds": 1800,
    "target_pace_seconds": 120,
    "target_pace_unit": "100m"
  },
  "input_schema": {
    "type": "object",
    "properties": {
      "mode": {
        "type": "string",
        "description": "pace: distance + time → pace; time: distance + target pace → time; distance: time + target pace → distance.",
        "enum": [
          "pace",
          "time",
          "distance"
        ],
        "default": "pace"
      },
      "stroke_type": {
        "type": "string",
        "description": "Stroke; only changes the SWOLF estimate (assumed strokes per 25 m).",
        "enum": [
          "freestyle",
          "backstroke",
          "breaststroke",
          "butterfly",
          "im"
        ],
        "default": "freestyle"
      },
      "distance_value": {
        "type": "number",
        "description": "Distance in distance_unit (default 1500).",
        "x-unit": "m",
        "minimum": 0,
        "default": 1500,
        "x-conditional": "only used when mode = pace or time"
      },
      "distance_unit": {
        "type": "string",
        "description": "Unit of distance_value; also the default pool_length_unit.",
        "enum": [
          "m",
          "yd"
        ],
        "default": "m"
      },
      "laps": {
        "type": "number",
        "description": "Optional: number of pool lengths; with pool_length it replaces distance_value.",
        "minimum": 0,
        "default": 0,
        "x-conditional": "only used when laps > 0"
      },
      "pool_length": {
        "type": "number",
        "description": "Pool length in pool_length_unit (default 25); used for laps and the SWOLF estimate.",
        "x-unit": "m",
        "minimum": 0,
        "default": 25
      },
      "pool_length_unit": {
        "type": "string",
        "description": "Unit of pool_length (defaults to distance_unit).",
        "enum": [
          "m",
          "yd"
        ],
        "default": "m"
      },
      "time_seconds": {
        "type": "number",
        "description": "Total swim time in seconds (default 1800).",
        "x-unit": "s",
        "minimum": 0,
        "default": 1800,
        "x-conditional": "only used when mode = pace or distance"
      },
      "target_pace_seconds": {
        "type": "number",
        "description": "Pace in seconds per 100 of target_pace_unit (default 120).",
        "x-unit": "s",
        "minimum": 0,
        "default": 120,
        "x-conditional": "only used when mode = time or distance"
      },
      "target_pace_unit": {
        "type": "string",
        "description": "Unit of target_pace_seconds.",
        "enum": [
          "100m",
          "100yd"
        ],
        "default": "100m",
        "x-conditional": "only used when mode = time or distance"
      }
    },
    "additionalProperties": false
  },
  "output_schema": {
    "type": "object",
    "properties": {
      "distanceMeters": {
        "type": "number",
        "description": "Distance, m (distanceYards in yd)."
      },
      "distanceYards": {
        "type": "number"
      },
      "totalTimeSeconds": {
        "type": "number",
        "description": "Total time, s."
      },
      "pacePer100mSeconds": {
        "type": "number",
        "description": "Pace, seconds per 100 m."
      },
      "pacePer100ydSeconds": {
        "type": "number",
        "description": "Pace, seconds per 100 yd."
      },
      "swolfEstimate": {
        "type": "number",
        "description": "Rough SWOLF: seconds per length + assumed strokes per length."
      },
      "effortZone": {
        "type": "string",
        "description": "Generic band by absolute pace per 100 m (not individualised)."
      },
      "strokeType": {
        "type": "string"
      }
    }
  },
  "summary": "Swim pace per 100 m and per 100 yd, total time or distance (pick which to solve with mode), plus a rough SWOLF estimate from typical stroke counts."
}
