{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://raw.githubusercontent.com/api-evangelist/robottraining-jobs/main/json-schema/robottraining-jobs-roles-document-schema.json",
  "title": "RolesDocument",
  "x-generated": "2026-10-15",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/robottraining-jobs-openapi.json#/components/schemas/RolesDocument",
  "allOf": [
    {
      "$ref": "#/$defs/DocumentInfo"
    },
    {
      "type": "object",
      "properties": {
        "totals": {
          "type": "object",
          "properties": {
            "open_roles": {
              "type": "integer"
            },
            "platforms_live": {
              "type": "integer"
            },
            "new_last_7d": {
              "type": "integer"
            },
            "new_last_7d_measurement": {
              "type": "string"
            }
          }
        },
        "recent_market_momentum": {
          "type": [
            "object",
            "null"
          ],
          "properties": {
            "unit": {
              "type": "string"
            },
            "measurement": {
              "type": "string"
            },
            "avg_new_roles_per_week": {
              "type": "number"
            },
            "weeks_measured": {
              "type": "integer"
            },
            "weekly": {
              "type": "array",
              "items": {
                "type": "object",
                "properties": {
                  "week_start": {
                    "type": "string",
                    "format": "date"
                  },
                  "new_roles": {
                    "type": "integer"
                  }
                }
              }
            }
          }
        },
        "open_by_work_type": {
          "type": "array",
          "items": {
            "allOf": [
              {
                "$ref": "#/$defs/PayBand"
              },
              {
                "type": "object",
                "properties": {
                  "slug": {
                    "type": "string"
                  },
                  "label": {
                    "type": "string"
                  },
                  "open_count": {
                    "type": "integer"
                  }
                }
              }
            ]
          }
        },
        "open_by_platform": {
          "type": "array",
          "items": {
            "type": "object",
            "properties": {
              "slug": {
                "type": "string"
              },
              "name": {
                "type": "string"
              },
              "open_count": {
                "type": "integer"
              }
            }
          }
        }
      }
    }
  ],
  "$defs": {
    "DocumentInfo": {
      "type": "object",
      "properties": {
        "name": {
          "type": "string"
        },
        "description": {
          "type": "string"
        },
        "source": {
          "type": "string",
          "format": "uri",
          "description": "The page that renders the same numbers."
        },
        "license": {
          "type": "string",
          "format": "uri"
        },
        "measurement_technique": {
          "type": "string"
        },
        "updated": {
          "type": "string",
          "format": "date-time",
          "description": "When the job feeds were last read (UTC)."
        },
        "temporal_coverage": {
          "type": "string",
          "format": "date",
          "description": "The day the figures describe. Cite this date."
        }
      }
    },
    "PayBand": {
      "type": "object",
      "properties": {
        "currency": {
          "type": [
            "string",
            "null"
          ]
        },
        "unit": {
          "type": [
            "string",
            "null"
          ]
        },
        "median": {
          "type": [
            "number",
            "null"
          ]
        },
        "typical_low": {
          "type": [
            "number",
            "null"
          ],
          "description": "25th percentile of advertised rates."
        },
        "typical_high": {
          "type": [
            "number",
            "null"
          ],
          "description": "75th percentile of advertised rates."
        },
        "rate_samples": {
          "type": [
            "integer",
            "null"
          ],
          "description": "Distinct advertised rates measured, after removing relistings."
        },
        "platforms": {
          "type": [
            "integer",
            "null"
          ],
          "description": "Platforms advertising those rates."
        }
      }
    }
  }
}