{
  "$schema":      "http://json-schema.org/draft-07/schema#",
  "$id":          "https://www.ziprecruiter.com/assets/static/schema/screener-questions-schema.json#",
  "x-version":    "1.0",
  "type":         "array",
  "uniqueItems":  true,
  "items": {
    "oneOf": [
      {"$ref": "#/definitions/informationQuestion"},
      {"$ref": "#/definitions/pagebreakQuestion"},
      {"$ref": "#/definitions/textQuestion"},
      {"$ref": "#/definitions/textareaQuestion"},
      {"$ref": "#/definitions/integerQuestion"},
      {"$ref": "#/definitions/decimalQuestion"},
      {"$ref": "#/definitions/dateQuestion"},
      {"$ref": "#/definitions/uploadQuestion"},
      {"$ref": "#/definitions/selectQuestion"},
      {"$ref": "#/definitions/radioQuestion"},
      {"$ref": "#/definitions/multiselectQuestion"},
      {"$ref": "#/definitions/checkboxQuestion"},
      {"$ref": "#/definitions/questionGroup"}
    ]
  },
  "definitions": {
    "informationQuestion": {
      "type":        "object",
      "required": ["id", "type","text"],
      "properties": {
        "id":        {"type": "string"},
        "type":      {"const": "information"},
        "text":  {"type": "string"}
      },
      "additionalProperties": false
    },
    "pagebreakQuestion": {
      "type":        "object",
      "required":    ["id", "type"],
      "properties":  {
        "id":        {"type": "string"},
        "type":      {"const": "pagebreak"}
      },
      "additionalProperties": false
    },
    "textQuestion": {
      "type":        "object",
      "required":    ["id", "type", "question"],
      "properties":  {
        "id":         {"type": "string"},
        "type":       {"const": "text"},
        "question":   {"type": "string"},
        "required":   {"type": "boolean"},
        "repeatable": {"type": "boolean"},
        "format":     {"enum": ["integer", "decimal"]},
        "min":        {"type": "number"},
        "max":        {"type": "number"},
        "limit":      {"type": "number"},
        "condition":  {"$ref": "#/definitions/condition"}
      },
      "additionalProperties": false
    },
    "textareaQuestion": {
      "type":        "object",
      "required":    ["id", "type", "question"],
      "properties":  {
        "id":         {"type": "string"},
        "type":       {"const": "textarea"},
        "question":   {"type": "string"},
        "required":   {"type": "boolean"},
        "repeatable": {"type": "boolean"},
        "min":        {"type": "number"},
        "max":        {"type": "number"},
        "limit":      {"type": "number"},
        "condition":  {"$ref": "#/definitions/condition"}
      },
      "additionalProperties": false
    },
    "integerQuestion": {
      "type":        "object",
      "required":    ["id", "type", "question"],
      "properties":  {
        "id":         {"type": "string"},
        "type":       {"const": "integer"},
        "question":   {"type": "string"},
        "required":   {"type": "boolean"},
        "repeatable": {"type": "boolean"},
        "min":        {"type": "number"},
        "max":        {"type": "number"},
        "condition":  {"$ref": "#/definitions/condition"}
      },
      "additionalProperties": false
    },
    "decimalQuestion": {
      "type":        "object",
      "required":    ["id", "type", "question"],
      "properties":  {
        "id":         {"type": "string"},
        "type":       {"const": "decimal"},
        "question":   {"type": "string"},
        "required":   {"type": "boolean"},
        "repeatable": {"type": "boolean"},
        "min":        {"type": "number"},
        "max":        {"type": "number"},
        "condition":  {"$ref": "#/definitions/condition"}
      },
      "additionalProperties": false
    },
    "dateQuestion": {
      "type":        "object",
      "required":    ["id", "type", "question"],
      "properties":   {
        "id":         {"type": "string"},
        "type":       {"const": "date"},
        "question":   {"type": "string"},
        "required":   {"type": "boolean"},
        "repeatable": {"type": "boolean"},
        "format":     {"enum": ["yyyy-MM-dd", "YYYY-MM-DD", "MM/dd/yyyy", "dd/MM/yyyy", "M/d/yyyy", "MM-dd-yyyy", "dd-MM-yyyy"]},
        "min":        {"type": "string"},
        "max":        {"type": "string"},
        "condition":  {"$ref": "#/definitions/condition"}
      },
      "additionalProperties": false
    },
    "uploadQuestion": {
      "type":        "object",
      "required":    ["id", "type", "question"],
      "properties":  {
        "id":        {"type": "string"},
        "type":      {"const": "upload"},
        "question":  {"type": "string"},
        "required":  {"type": "boolean"},
        "condition": {"$ref": "#/definitions/condition"}
      },
      "additionalProperties": false
    },
    "selectQuestion": {
      "type":        "object",
      "required":    ["id", "type", "question", "options"],
      "properties":  {
        "id":          {"type": "string"},
        "type":        {"const": "select"},
        "question":    {"type": "string"},
        "required":    {"type": "boolean"},
        "repeatable":  {"type": "boolean"},
        "dealbreaker": {"type": "boolean"},
        "condition":   {"$ref": "#/definitions/condition"},
        "options":     {"$ref": "#/definitions/optionList"}
      },
      "additionalProperties": false
    },
    "radioQuestion": {
      "type":        "object",
      "required":    ["id", "type", "question", "options"],
      "properties":  {
        "id":          {"type": "string"},
        "type":        {"const": "radio"},
        "question":    {"type": "string"},
        "required":    {"type": "boolean"},
        "repeatable":  {"type": "boolean"},
        "dealbreaker": {"type": "boolean"},
        "condition":   {"$ref": "#/definitions/condition"},
        "options":     {"$ref": "#/definitions/optionList"}
      },
      "additionalProperties": false
    },
    "multiselectQuestion": {
      "type":        "object",
      "required":    ["id", "type", "question", "options"],
      "properties":  {
        "id":          {"type": "string"},
        "type":        {"const": "multiselect"},
        "question":    {"type": "string"},
        "required":    {"type": "boolean"},
        "repeatable":  {"type": "boolean"},
        "dealbreaker": {"type": "boolean"},
        "condition":   {"$ref": "#/definitions/condition"},
        "options":     {"$ref": "#/definitions/optionList"}
      },
      "additionalProperties": false
    },
    "checkboxQuestion": {
      "type":        "object",
      "required":    ["id", "type", "question", "options"],
      "properties":  {
        "id":          {"type": "string"},
        "type":        {"const": "checkbox"},
        "question":    {"type": "string"},
        "required":    {"type": "boolean"},
        "repeatable":  {"type": "boolean"},
        "dealbreaker": {"type": "boolean"},
        "condition":   {"$ref": "#/definitions/condition"},
        "options":     {"$ref": "#/definitions/optionList"}
      },
      "additionalProperties": false
    },
    "questionGroup": {
      "type":        "object",
      "required":    ["id", "type", "question", "questions"],
      "properties":  {
        "id":         {"type": "string"},
        "type":       {"const": "question_group"},
        "question":   {"type": "string"},
        "repeatable": {"type": "boolean"},
        "questions":  {"$ref": "#/definitions/questionList"}
      },
      "additionalProperties": false
    },
    "optionList": {
      "type":         "array",
      "items":        {"$ref": "#/definitions/option"},
      "uniqueItems":  true
    },
    "option": {
      "type":        "object",
      "required":    ["label", "value"],
      "properties":  {
        "label":       {"type": "string"},
        "value":       {"type": "string"},
        "is_correct" : {"type": "boolean"}
      },
      "additionalProperties": false
    },
    "condition": {
      "type":        "object",
      "required":    ["id", "value"],
      "properties":  {
        "id":    {"type": "string"},
        "value": {"type": "string"}
      },
      "additionalProperties": false
    },
    "questionList": {
      "type":         "array",
      "uniqueItems":  true,
      "items": {
        "oneOf": [
          {"$ref": "#/definitions/informationQuestion"},
          {"$ref": "#/definitions/textQuestion"},
          {"$ref": "#/definitions/textareaQuestion"},
          {"$ref": "#/definitions/integerQuestion"},
          {"$ref": "#/definitions/decimalQuestion"},
          {"$ref": "#/definitions/dateQuestion"},
          {"$ref": "#/definitions/selectQuestion"},
          {"$ref": "#/definitions/radioQuestion"},
          {"$ref": "#/definitions/multiselectQuestion"},
          {"$ref": "#/definitions/checkboxQuestion"},
          {"$ref": "#/definitions/uploadQuestion"}
        ]
      },
      "additionalProperties": false
    }
  }
}
