{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/sportstatsapi/json-schema/sportstatsapi-handlers-horse-racing-form-response-schema.json",
  "title": "handlers.HorseRacingFormResponse",
  "x-generated": "2026-11-10",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/sportstatsapi-horse-racing-api-openapi.yml#/components/schemas/handlers.HorseRacingFormResponse",
  "properties": {
    "form": {
      "description": "Form: the horse's figures over these runs, oldest left (horses only):\n1-9 the place, 0 tenth or worse, a letter for no finish (P pulled up,\nF fell, U unseated rider, B brought down, R refused or ran out, S\nslipped up, C carried out, D disqualified); \"-\" between seasons, \"/\"\nafter a whole season or more without a run.",
      "type": "string"
    },
    "id": {
      "type": "integer"
    },
    "name": {
      "type": "string"
    },
    "profile": {
      "allOf": [
        {
          "$ref": "#/$defs/database.HorseRacingProfile"
        }
      ],
      "description": "Profile (horses only): from its latest HorseRacingProfileRuns runs in\nour data, not only the listed ones."
    },
    "runs": {
      "items": {
        "$ref": "#/$defs/handlers.HorseRacingRunResponse"
      },
      "type": "array"
    },
    "subject": {
      "enum": [
        "horse",
        "jockey",
        "trainer"
      ],
      "type": "string"
    },
    "summary": {
      "$ref": "#/$defs/handlers.HorseRacingFormSummary"
    }
  },
  "type": "object",
  "$defs": {
    "database.HorseRacingProfile": {
      "properties": {
        "best_rating": {
          "type": "integer"
        },
        "career": {
          "$ref": "#/$defs/database.HorseRacingTally"
        },
        "courses": {
          "items": {
            "$ref": "#/$defs/database.HorseRacingSplit"
          },
          "type": "array"
        },
        "distance": {
          "items": {
            "$ref": "#/$defs/database.HorseRacingSplit"
          },
          "type": "array"
        },
        "going": {
          "description": "By going, distance band and course: most runs first, then most wins.",
          "items": {
            "$ref": "#/$defs/database.HorseRacingSplit"
          },
          "type": "array"
        },
        "latest_rating": {
          "type": "integer"
        },
        "ratings": {
          "description": "Ratings: the official rating it ran off, oldest first (UK and Irish\nraces); BestRating the highest, LatestRating the latest of them.",
          "items": {
            "$ref": "#/$defs/database.HorseRacingRatingPoint"
          },
          "type": "array"
        }
      },
      "type": "object"
    },
    "database.HorseRacingRaceType": {
      "properties": {
        "class": {
          "description": "Class: the class number in the name (South Africa: \"Class 4\").",
          "type": "integer"
        },
        "code": {
          "description": "Code: flat or jumps (\"\" when the name does not say; USA races are flat).",
          "enum": [
            "flat",
            "jumps"
          ],
          "type": "string"
        },
        "grade": {
          "description": "Grade: \"Group 1\"..\"Group 3\", \"Grade 1\"..\"Grade 3\" or \"Listed\", when\nthe name says it.",
          "type": "string"
        },
        "kind": {
          "description": "Kind: the race's conditions.",
          "enum": [
            "handicap",
            "maiden",
            "novice",
            "claiming",
            "maiden_claiming",
            "selling",
            "allowance",
            "optional_claiming",
            "starter",
            "maiden_special_weight",
            "stakes",
            "conditions",
            "classified",
            "rated",
            "trial",
            "flat_race"
          ],
          "type": "string"
        },
        "label": {
          "description": "Label: a short neutral description (\"Novices' handicap chase\").",
          "type": "string"
        },
        "novice": {
          "type": "boolean"
        },
        "obstacle": {
          "description": "Obstacle: hurdle, chase, nh_flat (bumper) or cross_country (jumps only).",
          "enum": [
            "hurdle",
            "chase",
            "nh_flat",
            "cross_country"
          ],
          "type": "string"
        },
        "rating_band": {
          "description": "RatingBand: a merit-rated handicap's top rating (\"MR 78\", \"Fm 78\").",
          "type": "integer"
        }
      },
      "type": "object"
    },
    "database.HorseRacingRatingPoint": {
      "properties": {
        "date": {
          "type": "string"
        },
        "disc": {
          "description": "Disc: the race's discipline (HorseRacingDiscipline); a change in the\nrating compares like with like.",
          "type": "string"
        },
        "rating": {
          "type": "integer"
        }
      },
      "type": "object"
    },
    "database.HorseRacingSplit": {
      "properties": {
        "key": {
          "type": "string"
        },
        "label": {
          "type": "string"
        },
        "places": {
          "type": "integer"
        },
        "region": {
          "description": "a course's: the feed's (\"uk\"; Irish courses \"ie\")",
          "type": "string"
        },
        "runs": {
          "type": "integer"
        },
        "strike_rate": {
          "description": "wins per run in %, one decimal",
          "type": "number"
        },
        "wins": {
          "type": "integer"
        }
      },
      "type": "object"
    },
    "database.HorseRacingTally": {
      "properties": {
        "places": {
          "type": "integer"
        },
        "runs": {
          "type": "integer"
        },
        "strike_rate": {
          "description": "wins per run in %, one decimal",
          "type": "number"
        },
        "wins": {
          "type": "integer"
        }
      },
      "type": "object"
    },
    "dto.HorseRacingJockeyInfo": {
      "properties": {
        "id": {
          "type": "integer"
        },
        "name": {
          "type": "string"
        }
      },
      "type": "object"
    },
    "dto.HorseRacingTrainerInfo": {
      "properties": {
        "id": {
          "type": "integer"
        },
        "name": {
          "type": "string"
        }
      },
      "type": "object"
    },
    "handlers.HorseRacingFormSummary": {
      "properties": {
        "runs": {
          "type": "integer"
        },
        "strike_rate": {
          "description": "wins per run in %",
          "type": "number"
        },
        "top_three": {
          "type": "integer"
        },
        "wins": {
          "type": "integer"
        }
      },
      "type": "object"
    },
    "handlers.HorseRacingRunResponse": {
      "properties": {
        "beaten_lengths": {
          "description": "BeatenLengths: how far the winner beat this horse, the margins down\nto its place added up (a nose 0.05, a short head 0.1, a head 0.2, a\nneck 0.3); null for the winner or when a margin is missing.",
          "type": "number"
        },
        "course": {
          "type": "string"
        },
        "date": {
          "type": "string"
        },
        "dead_heat": {
          "type": "boolean"
        },
        "distance": {
          "type": "string"
        },
        "field_size": {
          "type": "integer"
        },
        "finish_code": {
          "type": "string"
        },
        "going": {
          "type": "string"
        },
        "horse": {
          "$ref": "#/$defs/dto.HorseRacingJockeyInfo"
        },
        "jockey": {
          "$ref": "#/$defs/dto.HorseRacingJockeyInfo"
        },
        "official_rating": {
          "description": "Rating: the official rating it ran off (UK and Irish races).",
          "type": "string"
        },
        "position": {
          "description": "null: did not finish",
          "type": "integer"
        },
        "race_class": {
          "type": "string"
        },
        "race_id": {
          "type": "integer"
        },
        "race_name": {
          "type": "string"
        },
        "race_type": {
          "allOf": [
            {
              "$ref": "#/$defs/database.HorseRacingRaceType"
            }
          ],
          "description": "RaceType: what the race name says (flat or jumps, handicap, maiden...)."
        },
        "region": {
          "type": "string"
        },
        "sp": {
          "type": "string"
        },
        "sp_decimal": {
          "type": "number"
        },
        "time": {
          "type": "string"
        },
        "trainer": {
          "$ref": "#/$defs/dto.HorseRacingTrainerInfo"
        }
      },
      "type": "object"
    }
  }
}