{
  "$defs": {
    "ObservationCoverage": {
      "additionalProperties": false,
      "description": "Source owner's explicit completeness declaration, never inferred from rows.",
      "properties": {
        "tenant_id": {
          "title": "Tenant Id",
          "type": "string"
        },
        "agreement_id": {
          "title": "Agreement Id",
          "type": "string"
        },
        "agreement_version": {
          "title": "Agreement Version",
          "type": "string"
        },
        "source": {
          "title": "Source",
          "type": "string"
        },
        "complete_from": {
          "format": "date-time",
          "title": "Complete From",
          "type": "string"
        },
        "complete_through": {
          "format": "date-time",
          "title": "Complete Through",
          "type": "string"
        },
        "observed_at": {
          "format": "date-time",
          "title": "Observed At",
          "type": "string"
        },
        "evidence_ref": {
          "maxLength": 300,
          "minLength": 1,
          "title": "Evidence Ref",
          "type": "string"
        }
      },
      "required": [
        "tenant_id",
        "agreement_id",
        "agreement_version",
        "source",
        "complete_from",
        "complete_through",
        "observed_at",
        "evidence_ref"
      ],
      "title": "ObservationCoverage",
      "type": "object"
    }
  },
  "additionalProperties": false,
  "properties": {
    "tenant_id": {
      "title": "Tenant Id",
      "type": "string"
    },
    "source_instance_id": {
      "title": "Source Instance Id",
      "type": "string"
    },
    "run_id": {
      "title": "Run Id",
      "type": "string"
    },
    "started_at": {
      "format": "date-time",
      "title": "Started At",
      "type": "string"
    },
    "finished_at": {
      "format": "date-time",
      "title": "Finished At",
      "type": "string"
    },
    "status": {
      "enum": [
        "succeeded",
        "partial",
        "failed"
      ],
      "title": "Status",
      "type": "string"
    },
    "records_read": {
      "minimum": 0,
      "title": "Records Read",
      "type": "integer"
    },
    "records_accepted": {
      "minimum": 0,
      "title": "Records Accepted",
      "type": "integer"
    },
    "duplicates": {
      "default": 0,
      "minimum": 0,
      "title": "Duplicates",
      "type": "integer"
    },
    "conflicts": {
      "default": 0,
      "minimum": 0,
      "title": "Conflicts",
      "type": "integer"
    },
    "errors": {
      "default": 0,
      "minimum": 0,
      "title": "Errors",
      "type": "integer"
    },
    "error_categories": {
      "default": [],
      "items": {
        "enum": [
          "authentication",
          "rate_limit",
          "schema",
          "transport",
          "mapping"
        ],
        "type": "string"
      },
      "title": "Error Categories",
      "type": "array"
    },
    "schema_fingerprint": {
      "pattern": "^[a-f0-9]{64}$",
      "title": "Schema Fingerprint",
      "type": "string"
    },
    "cursor_before": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "title": "Cursor Before"
    },
    "cursor_after": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "title": "Cursor After"
    },
    "coverage": {
      "default": [],
      "items": {
        "$ref": "#/$defs/ObservationCoverage"
      },
      "title": "Coverage",
      "type": "array"
    },
    "evidence_ref": {
      "maxLength": 300,
      "minLength": 1,
      "title": "Evidence Ref",
      "type": "string"
    }
  },
  "required": [
    "tenant_id",
    "source_instance_id",
    "run_id",
    "started_at",
    "finished_at",
    "status",
    "records_read",
    "records_accepted",
    "schema_fingerprint",
    "evidence_ref"
  ],
  "title": "ConnectorRun",
  "type": "object"
}
