{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://openteesheet.com/schemas/golfer-sessions.schema.json",
  "title": "OpenTeeSheet golfer sessions export (open format v1)",
  "description": "A golfer's OWN session history across every OpenTeeSheet venue: per session the venue, bay, launch-monitor brand, how the session started, the real start and stop from the bay where the bay reports them (else the booked time, and which), minutes played and how it ended, with per-venue and per-month totals. Shot and round data is NOT included: it stays with the launch-monitor maker (shot_data.included is always false). The same document from the account page's download, GET /api/v1/me/sessions, `openteesheet my-sessions` and the MCP tool export_my_sessions.",
  "type": "object",
  "properties": {
    "format": {
      "const": "openteesheet.golfer-sessions"
    },
    "version": {
      "const": 1
    },
    "schema": {
      "const": "https://openteesheet.com/schemas/golfer-sessions.schema.json"
    },
    "exported_at": {
      "type": "string",
      "format": "date-time"
    },
    "shot_data": {
      "type": "object",
      "properties": {
        "included": {
          "const": false
        },
        "why": {
          "type": "string",
          "minLength": 1
        }
      },
      "required": [
        "included",
        "why"
      ],
      "additionalProperties": false
    },
    "sessions": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "object": {
            "const": "golfer_session"
          },
          "booking_id": {
            "type": "string",
            "format": "uuid"
          },
          "venue_name": {
            "type": "string",
            "minLength": 1
          },
          "venue_slug": {
            "type": [
              "string",
              "null"
            ]
          },
          "venue_city": {
            "type": [
              "string",
              "null"
            ]
          },
          "venue_timezone": {
            "type": [
              "string",
              "null"
            ]
          },
          "bay_name": {
            "type": [
              "string",
              "null"
            ]
          },
          "launch_monitor": {
            "type": [
              "string",
              "null"
            ],
            "description": "The brand key (trackman, foresight, uneekor, full_swing, aboutgolf, golfzon, flightscope, skytrak, garmin, other); null when the venue did not name one."
          },
          "launch_monitor_label": {
            "type": [
              "string",
              "null"
            ]
          },
          "session_start": {
            "type": [
              "string",
              "null"
            ],
            "enum": [
              "booking_start",
              "door_open",
              null
            ],
            "description": "How the bay starts a session: at the booking time, or when the door opens. null = this bay does not report sessions, so only the booked time is known."
          },
          "booked_start": {
            "type": "string",
            "format": "date-time"
          },
          "booked_end": {
            "type": "string",
            "format": "date-time"
          },
          "started_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time",
            "description": "When the bay reported the session started; null when it did not."
          },
          "stopped_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time",
            "description": "When the bay reported the session stopped; null when it did not."
          },
          "start_from": {
            "type": "string",
            "enum": [
              "bay",
              "booking"
            ]
          },
          "stop_from": {
            "type": "string",
            "enum": [
              "bay",
              "booking"
            ]
          },
          "minutes_played": {
            "type": "integer",
            "minimum": 0
          },
          "ending": {
            "type": "string",
            "enum": [
              "ended",
              "stopped_early",
              "failed_to_start",
              "no_show"
            ]
          }
        },
        "required": [
          "object",
          "booking_id",
          "venue_name",
          "venue_slug",
          "venue_city",
          "venue_timezone",
          "bay_name",
          "launch_monitor",
          "launch_monitor_label",
          "session_start",
          "booked_start",
          "booked_end",
          "started_at",
          "stopped_at",
          "start_from",
          "stop_from",
          "minutes_played",
          "ending"
        ],
        "additionalProperties": false
      }
    },
    "rollups": {
      "type": "object",
      "properties": {
        "by_venue": {
          "type": "array",
          "items": {
            "type": "object",
            "properties": {
              "venue_name": {
                "type": "string"
              },
              "venue_slug": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "sessions": {
                "type": "integer",
                "minimum": 0
              },
              "played": {
                "type": "integer",
                "minimum": 0
              },
              "minutes_played": {
                "type": "integer",
                "minimum": 0
              }
            },
            "required": [
              "venue_name",
              "venue_slug",
              "sessions",
              "played",
              "minutes_played"
            ],
            "additionalProperties": false
          }
        },
        "by_month": {
          "type": "array",
          "items": {
            "type": "object",
            "properties": {
              "month": {
                "type": "string",
                "pattern": "^\\d{4}-\\d{2}$"
              },
              "sessions": {
                "type": "integer",
                "minimum": 0
              },
              "played": {
                "type": "integer",
                "minimum": 0
              },
              "minutes_played": {
                "type": "integer",
                "minimum": 0
              }
            },
            "required": [
              "month",
              "sessions",
              "played",
              "minutes_played"
            ],
            "additionalProperties": false
          }
        }
      },
      "required": [
        "by_venue",
        "by_month"
      ],
      "additionalProperties": false
    },
    "counts": {
      "type": "object",
      "properties": {
        "sessions": {
          "type": "integer",
          "minimum": 0
        },
        "played": {
          "type": "integer",
          "minimum": 0
        },
        "minutes_played": {
          "type": "integer",
          "minimum": 0
        }
      },
      "required": [
        "sessions",
        "played",
        "minutes_played"
      ],
      "additionalProperties": false
    }
  },
  "required": [
    "format",
    "version",
    "schema",
    "exported_at",
    "shot_data",
    "sessions",
    "rollups",
    "counts"
  ],
  "additionalProperties": false
}
