{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://rctp.dev/schemas/question.schema.json",
  "title": "Buyer question",
  "description": "A buyer's question on a listing, as returned by GET /listings/{id}/questions.",
  "type": "object",
  "properties": {
    "question_id": {
      "type": "string",
      "pattern": "^q_[A-Za-z0-9]{6,40}$"
    },
    "listing_id": {
      "$ref": "common.schema.json#/$defs/ListingId"
    },
    "text": {
      "type": "string",
      "minLength": 1,
      "maxLength": 1000
    },
    "asked_at": {
      "$ref": "common.schema.json#/$defs/Timestamp"
    },
    "answer": {
      "type": "string",
      "maxLength": 2000
    },
    "answered_at": {
      "$ref": "common.schema.json#/$defs/Timestamp"
    }
  },
  "additionalProperties": false,
  "required": [
    "question_id",
    "listing_id",
    "text",
    "asked_at"
  ]
}
