{
  "$schema":      "http://json-schema.org/draft-07/schema#",
  "$id":          "https://www.ziprecruiter.com/assets/static/schema/answers-schema-v2.json#",
  "x-version":    "1.0",
  "type":         "array",
  "uniqueItems":  true,
  "items": {
    "oneOf": [
      {"$ref": "#/definitions/singleAnswer"},
      {"$ref": "#/definitions/multiAnswer"},
      {"$ref": "#/definitions/uploadAnswer"},
      {"$ref": "#/definitions/repeatableQuestionAnswer"},
      {"$ref": "#/definitions/answerGroup"}
    ]
  },
  "definitions": {
    "singleAnswer": {
      "type":     "object",
      "required": ["id", "value"],
      "properties": {
        "id":     {"type": "string"},
        "value":  {"type": "string"}
      },
      "additionalProperties": false
    },
    "multiAnswer": {
      "type":     "object",
      "required": ["id", "values"],
      "properties": {
        "id":     {"type": "string"},
        "values": {
          "type": "array",
          "uniqueItems":  true,
          "items": {"type": "string"}
        }
      },
      "additionalProperties": false
    },
    "uploadAnswer": {
      "type":        "object",
      "required": ["id", "value", "filename"],
      "properties": {
        "id":       {"type": "string"},
        "value":    {"type": "string"},
        "filename": {"type": "string"}
      },
      "additionalProperties": false
    },
    "repeatableQuestionAnswer": {
      "type":        "object",
      "required": ["id", "entries"],
      "properties": {
        "id":     {"type": "string"},
        "entries":  {
          "type": "array",
          "uniqueItems":  true,
          "items": {
            "oneOf": [
              {
                "required": ["value"],
                "properties": {
                  "value": {"type": "string"}
                }
              },
              {
                "required": ["values"],
                "properties": {
                  "values": {
                    "type": "array",
                    "uniqueItems": true,
                    "items": {"type": "string"}
                  }
                }
              }
            ]
          }
        }
      },
      "additionalProperties": false
    },
    "answerGroup": {
      "type":     "object",
      "required": ["id", "answer_group"],
      "properties": {
        "id": { "type": "string" },
        "answer_group": {
          "type": "array",
          "items": {
            "type": "object",
            "additionalProperties": {
              "type": "array",
              "uniqueItems": true,
              "items": { "type": "string" }
            }
          }
        }
      },
      "additionalProperties": false
    }
  }
}
