{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://backpr.com/standard/v1/program.schema.json",
  "$comment": "Open Youth Registration format 1.x, BackPR, https://backpr.com/open-youth-registration. CC BY 4.0: https://creativecommons.org/licenses/by/4.0/",
  "title": "Program",
  "description": "A program and its sessions. Custom fields must start with x- (for example x-bunk); other names are reserved for this format. Software that rewrites a file must keep fields it doesn't recognize.",
  "type": "object",
  "properties": {
    "id": {
      "$ref": "common.schema.json#/$defs/id"
    },
    "name": {
      "type": "string"
    },
    "description": {
      "type": "string"
    },
    "organization": {
      "type": "object",
      "properties": {
        "name": {
          "type": "string"
        },
        "ein": {
          "type": "string"
        },
        "website": {
          "type": "string",
          "format": "uri"
        }
      }
    },
    "ageRange": {
      "type": "object",
      "properties": {
        "min": {
          "type": "integer",
          "minimum": 0,
          "description": "Inclusive, whole years."
        },
        "max": {
          "type": "integer",
          "minimum": 0,
          "description": "Inclusive, whole years."
        },
        "asOf": {
          "$ref": "common.schema.json#/$defs/date",
          "description": "Date ages are calculated on. If absent, the session start date."
        }
      }
    },
    "grades": {
      "type": "array",
      "items": {
        "$ref": "participant.schema.json#/properties/grade/properties/level"
      }
    },
    "location": {
      "type": "object",
      "properties": {
        "name": {
          "type": "string"
        },
        "address": {
          "$ref": "common.schema.json#/$defs/address"
        }
      }
    },
    "timeZone": {
      "type": "string",
      "description": "IANA time zone, for example America/Chicago. Session times are local to it."
    },
    "sessions": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "id": {
            "$ref": "common.schema.json#/$defs/id"
          },
          "name": {
            "type": "string"
          },
          "startDate": {
            "$ref": "common.schema.json#/$defs/date"
          },
          "endDate": {
            "$ref": "common.schema.json#/$defs/date"
          },
          "daysOfWeek": {
            "type": "array",
            "items": {
              "enum": [
                "mon",
                "tue",
                "wed",
                "thu",
                "fri",
                "sat",
                "sun"
              ]
            }
          },
          "startTime": {
            "$ref": "common.schema.json#/$defs/time"
          },
          "endTime": {
            "$ref": "common.schema.json#/$defs/time"
          },
          "capacity": {
            "type": "integer",
            "minimum": 0
          },
          "price": {
            "$ref": "common.schema.json#/$defs/money"
          },
          "deposit": {
            "$ref": "common.schema.json#/$defs/money"
          }
        },
        "required": [
          "id",
          "name"
        ]
      }
    }
  },
  "required": [
    "id",
    "name"
  ],
  "additionalProperties": true
}