{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/balladic-com/json-schema/balladic-com-conversation-response-schema.json",
  "title": "ConversationResponse",
  "x-generated": "2026-11-10",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/balladic-com-chat-api-openapi.yml#/components/schemas/ConversationResponse",
  "properties": {
    "id": {
      "type": "string",
      "format": "uuid",
      "title": "Id"
    },
    "type": {
      "$ref": "#/$defs/ConversationType"
    },
    "project_id": {
      "anyOf": [
        {
          "type": "string",
          "format": "uuid"
        },
        {
          "type": "null"
        }
      ],
      "title": "Project Id"
    },
    "project_title": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "title": "Project Title"
    },
    "project_color": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "title": "Project Color"
    },
    "project_slug": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "title": "Project Slug"
    },
    "participants": {
      "items": {
        "$ref": "#/$defs/ParticipantSummary"
      },
      "type": "array",
      "title": "Participants"
    },
    "last_message": {
      "anyOf": [
        {
          "$ref": "#/$defs/ChatMessageResponse"
        },
        {
          "type": "null"
        }
      ]
    },
    "unread_count": {
      "type": "integer",
      "title": "Unread Count",
      "default": 0
    }
  },
  "type": "object",
  "required": [
    "id",
    "type",
    "project_id",
    "participants"
  ],
  "$defs": {
    "ChatAttachmentResponse": {
      "properties": {
        "id": {
          "type": "string",
          "format": "uuid",
          "title": "Id"
        },
        "number": {
          "type": "integer",
          "title": "Number"
        },
        "filename": {
          "type": "string",
          "title": "Filename"
        },
        "content_type": {
          "type": "string",
          "title": "Content Type"
        },
        "size_bytes": {
          "type": "integer",
          "title": "Size Bytes"
        },
        "created_at": {
          "type": "string",
          "format": "date-time",
          "title": "Created At"
        }
      },
      "type": "object",
      "required": [
        "id",
        "number",
        "filename",
        "content_type",
        "size_bytes",
        "created_at"
      ],
      "title": "ChatAttachmentResponse"
    },
    "ChatMessageResponse": {
      "properties": {
        "id": {
          "type": "string",
          "format": "uuid",
          "title": "Id"
        },
        "number": {
          "type": "integer",
          "title": "Number"
        },
        "conversation_id": {
          "type": "string",
          "format": "uuid",
          "title": "Conversation Id"
        },
        "user_id": {
          "type": "string",
          "format": "uuid",
          "title": "User Id"
        },
        "user_name": {
          "type": "string",
          "title": "User Name"
        },
        "user_avatar_key": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "User Avatar Key"
        },
        "body": {
          "additionalProperties": true,
          "type": "object",
          "title": "Body"
        },
        "reply_to_id": {
          "anyOf": [
            {
              "type": "string",
              "format": "uuid"
            },
            {
              "type": "null"
            }
          ],
          "title": "Reply To Id"
        },
        "created_at": {
          "type": "string",
          "format": "date-time",
          "title": "Created At"
        },
        "attachments": {
          "items": {
            "$ref": "#/$defs/ChatAttachmentResponse"
          },
          "type": "array",
          "title": "Attachments"
        }
      },
      "type": "object",
      "required": [
        "id",
        "number",
        "conversation_id",
        "user_id",
        "user_name",
        "user_avatar_key",
        "body",
        "reply_to_id",
        "created_at",
        "attachments"
      ],
      "title": "ChatMessageResponse"
    },
    "ConversationType": {
      "type": "string",
      "enum": [
        "dm",
        "project_room"
      ],
      "title": "ConversationType"
    },
    "ParticipantSummary": {
      "properties": {
        "user_id": {
          "type": "string",
          "format": "uuid",
          "title": "User Id"
        },
        "name": {
          "type": "string",
          "title": "Name"
        },
        "avatar_key": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Avatar Key"
        }
      },
      "type": "object",
      "required": [
        "user_id",
        "name",
        "avatar_key"
      ],
      "title": "ParticipantSummary"
    }
  }
}