{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/reachium-io/json-schema/reachium-io-conversation-schema.json",
  "title": "Conversation",
  "x-generated": "2026-11-22",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/reachium-io-openapi.yml#/components/schemas/Conversation",
  "type": "object",
  "properties": {
    "chat_id": {
      "type": "string"
    },
    "name": {
      "type": [
        "string",
        "null"
      ]
    },
    "unread": {
      "type": [
        "integer",
        "null"
      ]
    },
    "last_message_at": {
      "type": [
        "string",
        "null"
      ],
      "format": "date-time"
    },
    "linkedin_account": {
      "oneOf": [
        {
          "$ref": "#/$defs/LinkedInAccountRef"
        },
        {
          "type": "null"
        }
      ]
    },
    "campaign_id": {
      "type": [
        "string",
        "null"
      ]
    },
    "campaign": {
      "oneOf": [
        {
          "$ref": "#/$defs/ConversationCampaignRef"
        },
        {
          "type": "null"
        }
      ]
    },
    "lead": {
      "oneOf": [
        {
          "$ref": "#/$defs/ConversationLead"
        },
        {
          "type": "null"
        }
      ]
    },
    "lead_state": {
      "type": [
        "string",
        "null"
      ]
    },
    "status": {
      "type": [
        "string",
        "null"
      ]
    },
    "tags": {
      "type": "array",
      "items": {
        "type": "string"
      }
    },
    "last_category": {
      "type": [
        "string",
        "null"
      ]
    }
  },
  "required": [
    "chat_id",
    "name",
    "unread",
    "last_message_at",
    "linkedin_account",
    "campaign_id",
    "campaign",
    "lead",
    "lead_state",
    "status",
    "tags",
    "last_category"
  ],
  "$defs": {
    "ConversationCampaignRef": {
      "type": "object",
      "properties": {
        "id": {
          "type": "string"
        },
        "name": {
          "type": [
            "string",
            "null"
          ]
        }
      },
      "required": [
        "id",
        "name"
      ]
    },
    "ConversationLead": {
      "type": "object",
      "properties": {
        "id": {
          "type": "string"
        },
        "name": {
          "type": [
            "string",
            "null"
          ]
        },
        "linkedin_url": {
          "type": [
            "string",
            "null"
          ]
        },
        "job_title": {
          "type": [
            "string",
            "null"
          ]
        },
        "company_name": {
          "type": [
            "string",
            "null"
          ]
        }
      },
      "required": [
        "id",
        "name",
        "linkedin_url",
        "job_title",
        "company_name"
      ]
    },
    "LinkedInAccountRef": {
      "type": "object",
      "properties": {
        "id": {
          "type": "string"
        },
        "name": {
          "type": [
            "string",
            "null"
          ]
        }
      },
      "required": [
        "id",
        "name"
      ]
    }
  }
}