{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/aidemos-com/json-schema/aidemos-com-batch-schema.json",
  "title": "Batch",
  "x-generated": "2026-11-10",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/aidemos-com-company-relationships-api-openapi.yml#/components/schemas/Batch",
  "properties": {
    "schema_version": {
      "type": "integer",
      "const": 1,
      "title": "Schema Version"
    },
    "run_id": {
      "type": "string",
      "maxLength": 150,
      "minLength": 8,
      "title": "Run Id"
    },
    "session_id": {
      "type": "string",
      "pattern": "^(session_|cse_)[A-Za-z0-9]+$",
      "title": "Session Id"
    },
    "behavior_version": {
      "type": "string",
      "enum": [
        "company-intelligence-v1",
        "company-intelligence-v2"
      ],
      "title": "Behavior Version"
    },
    "mailbox": {
      "type": "string",
      "const": "collaborate@aidemos.com",
      "title": "Mailbox"
    },
    "previous_cursor": {
      "anyOf": [
        {
          "$ref": "#/$defs/Cursor"
        },
        {
          "type": "null"
        }
      ]
    },
    "next_cursor": {
      "$ref": "#/$defs/Cursor"
    },
    "coverage": {
      "$ref": "#/$defs/Coverage"
    },
    "communications": {
      "items": {
        "$ref": "#/$defs/Communication"
      },
      "type": "array",
      "maxItems": 1000,
      "title": "Communications"
    },
    "bindings": {
      "items": {
        "$ref": "#/$defs/Binding"
      },
      "type": "array",
      "maxItems": 100,
      "title": "Bindings"
    },
    "findings": {
      "items": {
        "$ref": "#/$defs/Finding"
      },
      "type": "array",
      "maxItems": 300,
      "title": "Findings"
    }
  },
  "additionalProperties": false,
  "type": "object",
  "required": [
    "schema_version",
    "run_id",
    "session_id",
    "behavior_version",
    "mailbox",
    "previous_cursor",
    "next_cursor",
    "coverage",
    "communications",
    "bindings",
    "findings"
  ],
  "$defs": {
    "Attachment": {
      "properties": {
        "filename": {
          "type": "string",
          "maxLength": 1000,
          "title": "Filename"
        },
        "mime_type": {
          "anyOf": [
            {
              "type": "string",
              "maxLength": 200
            },
            {
              "type": "null"
            }
          ],
          "title": "Mime Type"
        },
        "size": {
          "anyOf": [
            {
              "type": "integer",
              "minimum": 0.0
            },
            {
              "type": "null"
            }
          ],
          "title": "Size"
        },
        "attachment_id": {
          "anyOf": [
            {
              "type": "string",
              "maxLength": 3000
            },
            {
              "type": "null"
            }
          ],
          "title": "Attachment Id"
        }
      },
      "additionalProperties": false,
      "type": "object",
      "required": [
        "filename"
      ],
      "title": "Attachment"
    },
    "Binding": {
      "properties": {
        "thread_id": {
          "type": "string",
          "pattern": "^[a-f0-9]{8,32}$",
          "title": "Thread Id"
        },
        "company_id": {
          "type": "string",
          "format": "uuid",
          "title": "Company Id"
        },
        "reason": {
          "type": "string",
          "maxLength": 1500,
          "minLength": 10,
          "title": "Reason"
        },
        "evidence_message_ids": {
          "items": {
            "type": "string"
          },
          "type": "array",
          "maxItems": 30,
          "minItems": 1,
          "title": "Evidence Message Ids"
        }
      },
      "additionalProperties": false,
      "type": "object",
      "required": [
        "thread_id",
        "company_id",
        "reason",
        "evidence_message_ids"
      ],
      "title": "Binding"
    },
    "Communication": {
      "properties": {
        "message_id": {
          "type": "string",
          "pattern": "^[a-f0-9]{8,32}$",
          "title": "Message Id"
        },
        "thread_id": {
          "type": "string",
          "pattern": "^[a-f0-9]{8,32}$",
          "title": "Thread Id"
        },
        "content_hash": {
          "type": "string",
          "pattern": "^[a-f0-9]{64}$",
          "title": "Content Hash"
        },
        "received_at": {
          "type": "string",
          "format": "date-time",
          "title": "Received At"
        },
        "header_date": {
          "anyOf": [
            {
              "type": "string",
              "maxLength": 200
            },
            {
              "type": "null"
            }
          ],
          "title": "Header Date"
        },
        "direction": {
          "type": "string",
          "enum": [
            "inbound",
            "outbound",
            "internal",
            "unknown"
          ],
          "title": "Direction"
        },
        "sender": {
          "type": "string",
          "maxLength": 300,
          "title": "Sender"
        },
        "to": {
          "type": "string",
          "maxLength": 5000,
          "title": "To",
          "default": ""
        },
        "cc": {
          "type": "string",
          "maxLength": 5000,
          "title": "Cc",
          "default": ""
        },
        "subject": {
          "type": "string",
          "maxLength": 500,
          "title": "Subject"
        },
        "labels": {
          "items": {
            "type": "string"
          },
          "type": "array",
          "maxItems": 30,
          "title": "Labels"
        },
        "attachment_count": {
          "type": "integer",
          "maximum": 1000.0,
          "minimum": 0.0,
          "title": "Attachment Count"
        },
        "rfc_message_id": {
          "anyOf": [
            {
              "type": "string",
              "maxLength": 1000
            },
            {
              "type": "null"
            }
          ],
          "title": "Rfc Message Id"
        },
        "attachments": {
          "items": {
            "$ref": "#/$defs/Attachment"
          },
          "type": "array",
          "maxItems": 1000,
          "title": "Attachments"
        }
      },
      "additionalProperties": false,
      "type": "object",
      "required": [
        "message_id",
        "thread_id",
        "content_hash",
        "received_at",
        "direction",
        "sender",
        "subject",
        "attachment_count"
      ],
      "title": "Communication"
    },
    "Coverage": {
      "properties": {
        "thread_dispositions": {
          "additionalProperties": {
            "type": "string",
            "enum": [
              "reviewed",
              "unrelated",
              "unresolved"
            ]
          },
          "type": "object",
          "title": "Thread Dispositions"
        },
        "history_recovery": {
          "type": "boolean",
          "title": "History Recovery",
          "default": false
        },
        "backfill_complete": {
          "type": "boolean",
          "title": "Backfill Complete",
          "default": false
        },
        "threads": {
          "anyOf": [
            {
              "type": "integer",
              "maximum": 100.0,
              "minimum": 0.0
            },
            {
              "type": "null"
            }
          ],
          "title": "Threads"
        },
        "messages": {
          "anyOf": [
            {
              "type": "integer",
              "maximum": 1000.0,
              "minimum": 0.0
            },
            {
              "type": "null"
            }
          ],
          "title": "Messages"
        },
        "mailbox_messages_total": {
          "anyOf": [
            {
              "type": "integer",
              "minimum": 0.0
            },
            {
              "type": "null"
            }
          ],
          "title": "Mailbox Messages Total"
        }
      },
      "additionalProperties": false,
      "type": "object",
      "required": [
        "thread_dispositions"
      ],
      "title": "Coverage"
    },
    "Cursor": {
      "properties": {
        "history_id": {
          "type": "string",
          "maxLength": 100,
          "pattern": "^\\d+$",
          "title": "History Id"
        },
        "history_page_token": {
          "anyOf": [
            {
              "type": "string",
              "maxLength": 5000
            },
            {
              "type": "null"
            }
          ],
          "title": "History Page Token"
        },
        "backfill_page_token": {
          "anyOf": [
            {
              "type": "string",
              "maxLength": 5000
            },
            {
              "type": "null"
            }
          ],
          "title": "Backfill Page Token"
        },
        "backfill_complete": {
          "type": "boolean",
          "title": "Backfill Complete"
        },
        "outstanding_offset": {
          "type": "integer",
          "minimum": 0.0,
          "title": "Outstanding Offset",
          "default": 0
        }
      },
      "additionalProperties": false,
      "type": "object",
      "required": [
        "history_id",
        "backfill_complete"
      ],
      "title": "Cursor"
    },
    "Finding": {
      "properties": {
        "id": {
          "type": "string",
          "pattern": "^[a-f0-9]{64}$",
          "title": "Id"
        },
        "kind": {
          "type": "string",
          "enum": [
            "outreach",
            "response",
            "outbound_message",
            "meaningful_reply",
            "automated_receipt",
            "access_request",
            "access_acknowledgement",
            "access_offer",
            "access_invitation",
            "access_grant",
            "access_declined",
            "access_revoked",
            "access_limitation",
            "access_expiry",
            "access_renewal",
            "report_delivery",
            "report_acknowledgement",
            "report_feedback",
            "report_ready",
            "competitor_analysis",
            "competitor_analysis_delivery",
            "competitor_analysis_acknowledgement",
            "competitor_analysis_feedback",
            "commercial_interest",
            "commercial_discussion",
            "proposal",
            "commercial_outcome",
            "unanswered_question",
            "missed_reply",
            "commitment",
            "overdue_followup",
            "reactivation",
            "access_verification",
            "communication_quality",
            "source_conflict",
            "unrelated",
            "identity_unresolved",
            "call_requested",
            "call_proposed",
            "call_scheduled",
            "call_held",
            "call_cancelled"
          ],
          "title": "Kind"
        },
        "company_id": {
          "anyOf": [
            {
              "type": "string",
              "format": "uuid"
            },
            {
              "type": "null"
            }
          ],
          "title": "Company Id"
        },
        "subject_id": {
          "anyOf": [
            {
              "type": "string",
              "format": "uuid"
            },
            {
              "type": "null"
            }
          ],
          "title": "Subject Id"
        },
        "benchmark_version_id": {
          "anyOf": [
            {
              "type": "string",
              "format": "uuid"
            },
            {
              "type": "null"
            }
          ],
          "title": "Benchmark Version Id"
        },
        "round": {
          "anyOf": [
            {
              "type": "integer",
              "minimum": 1.0
            },
            {
              "type": "null"
            }
          ],
          "title": "Round"
        },
        "execution_task_id": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Execution Task Id"
        },
        "report_task_id": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Report Task Id"
        },
        "thread_id": {
          "type": "string",
          "pattern": "^[a-f0-9]{8,32}$",
          "title": "Thread Id"
        },
        "evidence_message_ids": {
          "items": {
            "type": "string"
          },
          "type": "array",
          "maxItems": 30,
          "minItems": 1,
          "title": "Evidence Message Ids"
        },
        "provenance": {
          "type": "string",
          "enum": [
            "original",
            "quoted",
            "claim",
            "unknown"
          ],
          "title": "Provenance"
        },
        "occurred_at": {
          "anyOf": [
            {
              "type": "string",
              "format": "date-time"
            },
            {
              "type": "null"
            }
          ],
          "title": "Occurred At"
        },
        "occurrence": {
          "type": "string",
          "enum": [
            "supported",
            "disputed",
            "unknown"
          ],
          "title": "Occurrence"
        },
        "summary": {
          "type": "string",
          "maxLength": 700,
          "minLength": 5,
          "title": "Summary"
        },
        "interpretation": {
          "type": "string",
          "maxLength": 1500,
          "minLength": 5,
          "title": "Interpretation"
        },
        "reason": {
          "type": "string",
          "maxLength": 1500,
          "minLength": 10,
          "title": "Reason"
        },
        "confidence": {
          "type": "string",
          "enum": [
            "high",
            "medium",
            "low"
          ],
          "title": "Confidence"
        },
        "waiting_on": {
          "type": "string",
          "enum": [
            "Us",
            "Company",
            "Third party",
            "Nobody",
            "Unknown"
          ],
          "title": "Waiting On"
        },
        "waiting_since": {
          "anyOf": [
            {
              "type": "string",
              "format": "date-time"
            },
            {
              "type": "null"
            }
          ],
          "title": "Waiting Since"
        },
        "next_action": {
          "type": "string",
          "maxLength": 1000,
          "minLength": 5,
          "title": "Next Action"
        },
        "owner_id": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Owner Id"
        },
        "owner_basis": {
          "type": "string",
          "enum": [
            "existing_clickup_owner",
            "proposed",
            "unassigned"
          ],
          "title": "Owner Basis"
        },
        "due_at": {
          "anyOf": [
            {
              "type": "string",
              "format": "date-time"
            },
            {
              "type": "null"
            }
          ],
          "title": "Due At"
        },
        "scheduled_for": {
          "anyOf": [
            {
              "type": "string",
              "format": "date-time"
            },
            {
              "type": "null"
            }
          ],
          "title": "Scheduled For"
        },
        "priority": {
          "type": "string",
          "enum": [
            "urgent",
            "high",
            "normal",
            "low"
          ],
          "title": "Priority"
        },
        "sentiment": {
          "type": "string",
          "enum": [
            "positive",
            "negative",
            "mixed",
            "unknown"
          ],
          "title": "Sentiment",
          "default": "unknown"
        },
        "missing_evidence": {
          "items": {
            "type": "string"
          },
          "type": "array",
          "maxItems": 20,
          "title": "Missing Evidence"
        },
        "supersedes_id": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Supersedes Id"
        }
      },
      "additionalProperties": false,
      "type": "object",
      "required": [
        "id",
        "kind",
        "company_id",
        "thread_id",
        "evidence_message_ids",
        "provenance",
        "occurred_at",
        "occurrence",
        "summary",
        "interpretation",
        "reason",
        "confidence",
        "waiting_on",
        "next_action",
        "owner_basis",
        "priority"
      ],
      "title": "Finding"
    }
  }
}