{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "#/components/schemas/schema",
  "title": "Schema",
  "type": "object",
  "description": "Schema information.",
  "required": [
    "title",
    "type",
    "description",
    "required",
    "properties"
  ],
  "properties": {
    "title": {
      "type": "string",
      "description": "Schema title.",
      "example": "Client profile schema."
    },
    "type": {
      "type": "string",
      "description": "Schema type.",
      "example": "object"
    },
    "description": {
      "type": "string",
      "description": "Schema's human readable description.",
      "example": "This schema describes a b2c customer profile."
    },
    "required": {
      "type": "array",
      "description": "Schema required fields.",
      "items": {
        "type": "string",
        "description": "Key of a field that is required in the schema."
      },
      "example": [
        "firstName",
        "lastName",
        "email",
        "document",
        "documentType"
      ]
    },
    "properties": {
      "type": "object",
      "description": "Object describing each field in your desired schema. In this object, each property is a new object, describing the field according to: `type` (string); `sensitive` (boolean); `pii` (boolean) and `items.type` (if field is array).",
      "properties": {
        "additionalProperties": {
          "type": "object",
          "description": "Schema of any given field described in the `properties` field.",
          "required": [
            "type",
            "sensitive",
            "pii"
          ],
          "properties": {
            "type": {
              "type": "string",
              "description": "Schema property type.",
              "example": "string"
            },
            "sensitive": {
              "type": "boolean",
              "description": "Indicates whether the property is sensitive data. Set to `true` if `pii` is `true` and set to `false` if `pii` is `false`.",
              "example": true
            },
            "pii": {
              "type": "boolean",
              "description": "Indicates whether the property is Personal Identifiable Information (PII).",
              "example": true
            },
            "items": {
              "type": "object",
              "description": "Object containing the type of the items if the field is an array. Typically, arrays will contain strings and will be used for fields such as `email`.",
              "properties": {
                "type": {
                  "type": "string",
                  "description": "Field type.",
                  "example": "string"
                }
              },
              "example": {
                "type": "string"
              }
            }
          }
        }
      }
    },
    "documentTTL": {
      "type": "integer",
      "description": "Document time to live, in days. After this many days from its creation or update, any document cerated from this schema will be deleted.",
      "example": 1825
    },
    "version": {
      "type": "integer",
      "description": "Schema version.",
      "example": 1
    },
    "v-indexed": {
      "type": "array",
      "description": "List of fields to be indexed.",
      "example": [
        "email",
        "document"
      ],
      "items": {
        "type": "string",
        "description": "Field to be indexed."
      }
    },
    "v-unique": {
      "type": "array",
      "description": "List of fields that must be unique.",
      "example": [
        "email",
        "document"
      ],
      "items": {
        "type": "string",
        "description": "Field that must be unique."
      }
    }
  }
}