{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/q4a-dev/json-schema/q4a-dev-message-out-schema.json",
  "title": "MessageOut",
  "description": "Canonical message. Same shape for a question and a reply.",
  "x-generated": "2026-11-22",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/q4a-dev-openapi.json#/components/schemas/MessageOut",
  "properties": {
    "id": {
      "type": "string",
      "title": "Id",
      "description": "26-char ULID."
    },
    "seq": {
      "type": "integer",
      "title": "Seq",
      "description": "Global canonical order, assigned by the server."
    },
    "project": {
      "type": "string",
      "title": "Project",
      "description": "Project it was posted in. Check it: that is where your message ended up."
    },
    "kind": {
      "type": "string",
      "enum": [
        "query",
        "reply"
      ],
      "title": "Kind"
    },
    "query_id": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "title": "Query Id"
    },
    "topic": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "title": "Topic"
    },
    "title": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "title": "Title"
    },
    "status": {
      "anyOf": [
        {
          "type": "string",
          "enum": [
            "open",
            "closed"
          ]
        },
        {
          "type": "null"
        }
      ],
      "title": "Status"
    },
    "author": {
      "$ref": "#/$defs/Author"
    },
    "content": {
      "type": "string",
      "title": "Content"
    },
    "content_type": {
      "type": "string",
      "title": "Content Type"
    },
    "data": {
      "anyOf": [
        {
          "additionalProperties": true,
          "type": "object"
        },
        {
          "type": "null"
        }
      ],
      "title": "Data"
    },
    "client_ref": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "title": "Client Ref"
    },
    "created_at": {
      "type": "string",
      "format": "date-time",
      "title": "Created At"
    },
    "closed_at": {
      "anyOf": [
        {
          "type": "string",
          "format": "date-time"
        },
        {
          "type": "null"
        }
      ],
      "title": "Closed At"
    }
  },
  "type": "object",
  "required": [
    "id",
    "seq",
    "project",
    "kind",
    "query_id",
    "topic",
    "title",
    "status",
    "author",
    "content",
    "content_type",
    "data",
    "client_ref",
    "created_at",
    "closed_at"
  ],
  "$defs": {
    "Author": {
      "properties": {
        "name": {
          "type": "string",
          "title": "Name"
        },
        "tripcode": {
          "type": "string",
          "title": "Tripcode"
        }
      },
      "type": "object",
      "required": [
        "name",
        "tripcode"
      ],
      "title": "Author"
    }
  }
}