{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/cogram-com/json-schema/cogram-com-backup-run-create-v1-schema.json",
  "title": "BackupRunCreateV1",
  "description": "One backup lifecycle event, reported by the connector.",
  "x-generated": "2026-11-10",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/cogram-com-backup-runs-api-openapi.yml#/components/schemas/BackupRunCreateV1",
  "properties": {
    "event": {
      "$ref": "#/$defs/ConnectorBackupEvent",
      "description": "`started` when a run begins, `finished` when it ends."
    },
    "schedule_interval_hours": {
      "type": "integer",
      "maximum": 8760.0,
      "minimum": 1.0,
      "title": "Schedule Interval Hours",
      "description": "The connector's configured interval between runs. Cogram measures backup health against this rather than a server-side setting, because only the connector knows its own schedule."
    },
    "status": {
      "anyOf": [
        {
          "$ref": "#/$defs/ConnectorBackupStatus"
        },
        {
          "type": "null"
        }
      ],
      "description": "Required on `finished`; must be omitted on `started`."
    },
    "projects_synced": {
      "anyOf": [
        {
          "type": "integer",
          "minimum": 0.0
        },
        {
          "type": "null"
        }
      ],
      "title": "Projects Synced",
      "description": "Projects filed by this run. Zero is a healthy result — a run with no changed projects exports nothing."
    },
    "error": {
      "anyOf": [
        {
          "type": "string",
          "maxLength": 2000
        },
        {
          "type": "null"
        }
      ],
      "title": "Error",
      "description": "Failure detail. Only meaningful when `status` is `failed`."
    }
  },
  "type": "object",
  "required": [
    "event",
    "schedule_interval_hours"
  ],
  "$defs": {
    "ConnectorBackupEvent": {
      "type": "string",
      "enum": [
        "started",
        "finished"
      ],
      "title": "ConnectorBackupEvent",
      "description": "Lifecycle point a connector reports."
    },
    "ConnectorBackupStatus": {
      "type": "string",
      "enum": [
        "success",
        "failed"
      ],
      "title": "ConnectorBackupStatus",
      "description": "Outcome of a finished run. Absent on ``started`` events."
    }
  }
}