{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "title": "feedback",
  "type": "object",
  "properties": {
    "source_alias": {
      "description": "A user-customizable label for grouping feedbacks",
      "type": "string"
    },
    "kind": {
      "description": "Group all data for this specific kind of feedback",
      "type": "object",
      "properties": {
        "name": {
          "description": "Kind of feedback",
          "type": "string",
          "enum": [
            "nps",
            "csat",
            "review",
            "ces"
          ]
        },
        "fields": {
          "description": "Object containing all relevant fields for this kind of feedback",
          "type": "object"
        }
      },
      "required": [
        "name",
        "fields"
      ],
      "additionalProperties": false
    },
    "batch_id": {
      "description": "ID of the batch which this feedback belongs to (optional)",
      "type": "string"
    },
    "language": {
      "description": "Language of the feedback as BCP 47 code",
      "type": "string",
      "example": "en-US"
    },
    "text": {
      "description": "Text posted by the user",
      "type": "string"
    },
    "posted_at": {
      "description": "When the feedback was posted",
      "type": "string",
      "format": "date-time",
      "example": "2023-08-12T15:30:00+00:00"
    },
    "archived": {
      "description": "True if the feedback is archived in the source",
      "type": "boolean"
    },
    "archived_at": {
      "description": "If the feedback is archived, when it happened",
      "type": "string",
      "format": "date-time"
    },
    "additional_fields": {
      "description": "Additional fields are fields that can be mapped to custom fields.",
      "type": "object",
      "additionalProperties": {
        "anyOf": [
          {
            "type": "string"
          },
          {
            "type": "number"
          },
          {
            "type": "integer"
          },
          {
            "type": "boolean"
          },
          {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          {
            "type": "array",
            "items": {
              "type": "number"
            }
          },
          {
            "type": "array",
            "items": {
              "type": "integer"
            }
          },
          {
            "type": "array",
            "items": {
              "type": "boolean"
            }
          }
        ]
      }
    }
  },
  "required": [
    "kind",
    "language",
    "posted_at"
  ]
}
