{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/sportstatsapi/json-schema/sportstatsapi-dto-motorsport-event-response-schema.json",
  "title": "dto.MotorsportEventResponse",
  "x-generated": "2026-11-10",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/sportstatsapi-motorsport-api-openapi.yml#/components/schemas/dto.MotorsportEventResponse",
  "properties": {
    "circuit": {
      "type": "string"
    },
    "country": {
      "type": "string"
    },
    "end_date": {
      "type": "string"
    },
    "id": {
      "type": "integer"
    },
    "name": {
      "type": "string"
    },
    "round": {
      "type": "integer"
    },
    "season": {
      "type": "integer"
    },
    "series": {
      "type": "string"
    },
    "sessions": {
      "items": {
        "$ref": "#/$defs/dto.MotorsportSessionOutput"
      },
      "type": "array"
    },
    "start_date": {
      "type": "string"
    },
    "status": {
      "type": "string"
    },
    "winner": {
      "allOf": [
        {
          "$ref": "#/$defs/database.MotorsportResult"
        }
      ],
      "description": "the race winner, once the race has results"
    }
  },
  "type": "object",
  "$defs": {
    "database.MotorsportResult": {
      "properties": {
        "country": {
          "description": "as the feed writes it: NED, Esp, Brazil",
          "type": "string"
        },
        "driver": {
          "type": "string"
        },
        "driver_id": {
          "type": "integer"
        },
        "grid": {
          "type": "integer"
        },
        "laps": {
          "type": "integer"
        },
        "pit_stops": {
          "type": "integer"
        },
        "position": {
          "type": "integer"
        },
        "status": {
          "type": "string"
        },
        "team": {
          "type": "string"
        },
        "team_id": {
          "type": "integer"
        },
        "time": {
          "description": "winner's time, gap (\"+1.363\", \"1 Lap\") or best lap",
          "type": "string"
        }
      },
      "type": "object"
    },
    "dto.MotorsportSessionOutput": {
      "properties": {
        "distance": {
          "description": "km",
          "type": "string"
        },
        "event_id": {
          "type": "integer"
        },
        "fastest_lap": {
          "type": "string"
        },
        "has_results": {
          "type": "boolean"
        },
        "id": {
          "type": "integer"
        },
        "kind": {
          "type": "string"
        },
        "name": {
          "type": "string"
        },
        "results": {
          "items": {
            "$ref": "#/$defs/database.MotorsportResult"
          },
          "type": "array"
        },
        "start": {
          "description": "UTC",
          "type": "string"
        },
        "status": {
          "type": "string"
        },
        "total_laps": {
          "type": "integer"
        },
        "updated_at": {
          "type": "string"
        }
      },
      "type": "object"
    }
  }
}