{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://raw.githubusercontent.com/api-evangelist/silverfin/main/json-schema/silverfin-insights-segment-run-pending-schema.json",
  "title": "InsightsSegmentRunPending",
  "x-generated": "2026-10-14",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/silverfin-api-openapi.yml#/components/schemas/InsightsSegmentRunPending",
  "allOf": [
    {
      "$ref": "#/$defs/InsightsSegmentRunBase"
    },
    {
      "type": "object",
      "required": [
        "progress"
      ],
      "properties": {
        "status": {
          "type": "string",
          "enum": [
            "pending"
          ]
        },
        "progress": {
          "type": "object",
          "required": [
            "processed_companies"
          ],
          "properties": {
            "processed_companies": {
              "type": "integer",
              "minimum": 0,
              "description": "Companies processed so far. Informational only: a two-pass run can count a company more than once."
            }
          }
        }
      }
    }
  ],
  "$defs": {
    "InsightsSegmentRunBase": {
      "type": "object",
      "required": [
        "status",
        "request_ref",
        "started_at",
        "finished_at"
      ],
      "properties": {
        "status": {
          "type": "string",
          "enum": [
            "pending",
            "finished"
          ]
        },
        "request_ref": {
          "type": "string",
          "format": "uuid"
        },
        "started_at": {
          "type": "string",
          "format": "date-time",
          "description": "Run creation time, with millisecond precision"
        },
        "finished_at": {
          "type": [
            "string",
            "null"
          ],
          "format": "date-time",
          "description": "Calculation completion time, or null while pending"
        }
      }
    }
  }
}