{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/softsync-ai/json-schema/softsync-ai-message-data-dto-schema.json",
  "title": "MessageDataDto",
  "x-generated": "2026-11-10",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/softsync-ai-notes-api-openapi.yml#/components/schemas/MessageDataDto",
  "type": "object",
  "properties": {
    "id": {
      "type": "string"
    },
    "integrationId": {
      "type": "string"
    },
    "integrationType": {
      "type": "string"
    },
    "content": {
      "type": "object"
    },
    "files": {
      "type": "array",
      "items": {
        "$ref": "#/$defs/FileAttachment"
      }
    },
    "metadata": {
      "type": "object"
    },
    "searchableText": {
      "type": "string"
    },
    "timestamp": {
      "format": "date-time",
      "type": "string"
    },
    "workspaceId": {
      "type": "string",
      "description": "The organization the message is in. Set only when reading across organizations."
    },
    "createdAt": {
      "format": "date-time",
      "type": "string"
    },
    "recordLinks": {
      "type": "array",
      "items": {
        "$ref": "#/$defs/MessageRecordLinkDto"
      }
    },
    "userLinks": {
      "type": "array",
      "items": {
        "$ref": "#/$defs/MessageUserLinkDto"
      }
    },
    "messageLinks": {
      "type": "array",
      "items": {
        "$ref": "#/$defs/MessageMessageLinkDto"
      }
    }
  },
  "required": [
    "id",
    "integrationId",
    "integrationType",
    "content",
    "files",
    "timestamp",
    "createdAt",
    "recordLinks",
    "userLinks",
    "messageLinks"
  ],
  "$defs": {
    "FileAttachment": {
      "type": "object",
      "properties": {
        "id": {
          "type": "string"
        },
        "path": {
          "type": "string"
        },
        "fileName": {
          "type": "string"
        },
        "fileSize": {
          "type": "number"
        },
        "mime": {
          "type": "string"
        },
        "isInline": {
          "type": "boolean"
        },
        "contentId": {
          "type": "string"
        },
        "url": {
          "type": "string"
        }
      },
      "required": [
        "id",
        "path",
        "fileName",
        "fileSize",
        "mime"
      ]
    },
    "LinkedMessageDto": {
      "type": "object",
      "properties": {
        "id": {
          "type": "string"
        },
        "integrationId": {
          "type": "string"
        },
        "integrationType": {
          "type": "string"
        },
        "content": {
          "type": "object"
        },
        "files": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/FileAttachment"
          }
        },
        "metadata": {
          "type": "object"
        },
        "searchableText": {
          "type": "string"
        },
        "timestamp": {
          "format": "date-time",
          "type": "string"
        },
        "workspaceId": {
          "type": "string",
          "description": "The organization the message is in. Set only when reading across organizations."
        },
        "createdAt": {
          "format": "date-time",
          "type": "string"
        },
        "recordLinks": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/MessageRecordLinkDto"
          }
        },
        "userLinks": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/MessageUserLinkDto"
          }
        }
      },
      "required": [
        "id",
        "integrationId",
        "integrationType",
        "content",
        "files",
        "timestamp",
        "createdAt",
        "recordLinks",
        "userLinks"
      ]
    },
    "MessageMessageLinkDto": {
      "type": "object",
      "properties": {
        "id": {
          "type": "string"
        },
        "linkedMessage": {
          "$ref": "#/$defs/LinkedMessageDto"
        },
        "kind": {
          "type": "string"
        }
      },
      "required": [
        "id",
        "linkedMessage",
        "kind"
      ]
    },
    "MessageRecordLinkDto": {
      "type": "object",
      "properties": {
        "id": {
          "type": "string"
        },
        "record": {
          "$ref": "#/$defs/RecordInfoDto"
        },
        "kind": {
          "type": "string"
        }
      },
      "required": [
        "id",
        "record",
        "kind"
      ]
    },
    "MessageUserLinkDto": {
      "type": "object",
      "properties": {
        "id": {
          "type": "string"
        },
        "user": {
          "$ref": "#/$defs/UserInfoDto"
        },
        "kind": {
          "type": "string"
        }
      },
      "required": [
        "id",
        "user",
        "kind"
      ]
    },
    "RecordInfoDto": {
      "type": "object",
      "properties": {
        "id": {
          "type": "string"
        },
        "table": {
          "type": "string"
        },
        "groups": {
          "type": "array",
          "items": {
            "type": "string"
          }
        },
        "data": {
          "type": "object",
          "description": "Raw data keyed by field ID"
        },
        "metadata": {
          "$ref": "#/$defs/RecordMetadata"
        },
        "createdAt": {
          "format": "date-time",
          "type": "string"
        },
        "updatedAt": {
          "format": "date-time",
          "type": "string"
        },
        "createdBy": {
          "type": "string"
        }
      },
      "required": [
        "id",
        "table",
        "data",
        "createdAt",
        "updatedAt"
      ]
    },
    "RecordMetadata": {
      "type": "object",
      "properties": {
        "viewOrders": {
          "type": "object",
          "additionalProperties": {
            "type": "number"
          },
          "description": "Orders in different views (viewId -> order)"
        },
        "avatarUrl": {
          "type": "string",
          "description": "Avatar file path stored in record metadata"
        },
        "formulaOverrides": {
          "description": "Calculated-default fields a person typed over; they are no longer recalculated",
          "type": "array",
          "items": {
            "type": "string"
          }
        },
        "ruleIssues": {
          "type": "array",
          "items": {
            "type": "object"
          },
          "description": "Rules this record breaks, saved by a change that may not be refused (e.g. a public booking). Cleared by the next save that passes."
        },
        "source": {
          "type": "object",
          "additionalProperties": true,
          "description": "The feature that made this record when no person did (a booking page, a form…)"
        }
      }
    },
    "UserInfoDto": {
      "type": "object",
      "properties": {
        "id": {
          "type": "string"
        },
        "email": {
          "type": "string"
        },
        "firstName": {
          "type": "string"
        },
        "lastName": {
          "type": "string"
        },
        "avatarUrl": {
          "type": "string"
        }
      },
      "required": [
        "id",
        "email"
      ]
    }
  }
}