{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/akeda-ru/json-schema/akeda-ru-chat-forwarded-message-schema.json",
  "title": "ChatForwardedMessage",
  "x-generated": "2026-11-10",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/akeda-ru-chat-api-openapi.yml#/components/schemas/ChatForwardedMessage",
  "type": "object",
  "additionalProperties": false,
  "required": [
    "id",
    "conversation_id",
    "seq",
    "sender_user_id",
    "kind",
    "body",
    "reply_to_message_id",
    "forwarded_from_message_id",
    "mentions",
    "reactions",
    "client_message_id",
    "created_at",
    "edited_at",
    "deleted_at",
    "attachments"
  ],
  "properties": {
    "id": {
      "$ref": "#/$defs/UUID"
    },
    "conversation_id": {
      "$ref": "#/$defs/UUID"
    },
    "seq": {
      "type": "integer",
      "format": "int64",
      "minimum": 1
    },
    "sender_user_id": {
      "type": [
        "integer",
        "null"
      ],
      "format": "int64"
    },
    "kind": {
      "type": "string",
      "enum": [
        "text",
        "system",
        "application",
        "file"
      ]
    },
    "body": {
      "type": "string"
    },
    "reply_to_message_id": {
      "type": [
        "string",
        "null"
      ],
      "format": "uuid"
    },
    "forwarded_from_message_id": {
      "type": [
        "string",
        "null"
      ],
      "format": "uuid"
    },
    "forwarded_from_user_id": {
      "type": "integer",
      "format": "int64",
      "minimum": 1
    },
    "forwarded_from_name": {
      "type": "string",
      "maxLength": 512
    },
    "mentions": {
      "type": "array",
      "items": {
        "$ref": "#/$defs/ChatMessageMention"
      }
    },
    "reactions": {
      "type": "array",
      "items": {
        "$ref": "#/$defs/ChatMessageReaction"
      }
    },
    "client_message_id": {
      "type": [
        "string",
        "null"
      ],
      "format": "uuid"
    },
    "created_at": {
      "type": "string",
      "format": "date-time"
    },
    "edited_at": {
      "type": [
        "string",
        "null"
      ],
      "format": "date-time"
    },
    "deleted_at": {
      "type": [
        "string",
        "null"
      ],
      "format": "date-time",
      "description": "Надгробие: сообщение удалено у всех"
    },
    "attachments": {
      "type": "array",
      "items": {
        "$ref": "#/$defs/ChatForwardedAttachment"
      }
    }
  },
  "$defs": {
    "ChatForwardedAttachment": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "id",
        "conversation_id",
        "message_id",
        "original_name",
        "content_type",
        "size_bytes",
        "sha256_hex",
        "media_kind",
        "duration_ms",
        "waveform",
        "status",
        "scan_status",
        "created_at",
        "content_url"
      ],
      "properties": {
        "id": {
          "$ref": "#/$defs/UUID"
        },
        "conversation_id": {
          "$ref": "#/$defs/UUID"
        },
        "message_id": {
          "type": [
            "string",
            "null"
          ],
          "format": "uuid"
        },
        "original_name": {
          "type": "string"
        },
        "content_type": {
          "type": "string"
        },
        "size_bytes": {
          "type": "integer",
          "format": "int64",
          "minimum": 1
        },
        "sha256_hex": {
          "type": "string",
          "pattern": "^[0-9a-f]{64}$"
        },
        "media_kind": {
          "type": "string",
          "enum": [
            "voice",
            "video_circle",
            "image",
            "video",
            "file"
          ]
        },
        "duration_ms": {
          "type": [
            "integer",
            "null"
          ],
          "format": "int64",
          "minimum": 0,
          "maximum": 600000
        },
        "waveform": {
          "type": "array",
          "maxItems": 64,
          "items": {
            "type": "integer",
            "minimum": 0,
            "maximum": 1000
          }
        },
        "status": {
          "type": "string",
          "enum": [
            "quarantined",
            "ready",
            "failed",
            "deleted"
          ]
        },
        "scan_status": {
          "type": "string",
          "enum": [
            "pending",
            "clean",
            "infected",
            "unavailable",
            "skipped"
          ]
        },
        "scan_error_code": {
          "type": "string"
        },
        "created_at": {
          "type": "string",
          "format": "date-time"
        },
        "content_url": {
          "type": "string"
        }
      }
    },
    "ChatMessageMention": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "user_id",
        "display_name"
      ],
      "properties": {
        "user_id": {
          "type": "integer",
          "format": "int64"
        },
        "display_name": {
          "type": "string"
        }
      }
    },
    "ChatMessageReaction": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "emoji",
        "count",
        "is_own"
      ],
      "properties": {
        "emoji": {
          "type": "string"
        },
        "count": {
          "type": "integer",
          "minimum": 1
        },
        "is_own": {
          "type": "boolean"
        }
      }
    },
    "UUID": {
      "type": "string",
      "format": "uuid"
    }
  }
}