{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/eurobase-dev/json-schema/eurobase-dev-deployment-logs-response-schema.json",
  "title": "DeploymentLogsResponse",
  "x-generated": "2026-11-10",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/eurobase-dev-deployments-api-openapi.yml#/components/schemas/DeploymentLogsResponse",
  "type": "object",
  "required": [
    "deploymentId",
    "source",
    "retentionPolicy",
    "retention",
    "truncatedLogKinds",
    "streamState",
    "streamStates",
    "runtimeLogState",
    "entries"
  ],
  "properties": {
    "retention": {
      "$ref": "#/$defs/DeploymentLogRetention"
    },
    "truncatedLogKinds": {
      "type": "array",
      "uniqueItems": true,
      "maxItems": 4,
      "items": {
        "type": "string",
        "enum": [
          "build",
          "deploy",
          "runtime",
          "event"
        ]
      },
      "description": "Replayed kinds whose newest window this read cut while older retained rows of that kind may exist (not removed by retention). Covers only the kinds this read replays: the requested logKind, or all four."
    },
    "deploymentId": {
      "type": "string"
    },
    "logKind": {
      "type": [
        "string",
        "null"
      ],
      "enum": [
        "build",
        "deploy",
        "runtime",
        "event",
        null
      ]
    },
    "source": {
      "type": "string",
      "enum": [
        "project_logs"
      ]
    },
    "cursor": {
      "type": [
        "string",
        "null"
      ]
    },
    "retentionPolicy": {
      "type": "object",
      "required": [
        "maxEntriesPerCategory",
        "maxAgeDays"
      ],
      "properties": {
        "maxEntriesPerCategory": {
          "type": "integer"
        },
        "maxAgeDays": {
          "type": "integer"
        }
      }
    },
    "streamState": {
      "$ref": "#/$defs/DeploymentLogStreamState"
    },
    "streamStates": {
      "$ref": "#/$defs/DeploymentLogStreamStateByKind"
    },
    "runtimeLogState": {
      "oneOf": [
        {
          "$ref": "#/$defs/RuntimeLogState"
        },
        {
          "type": "null"
        }
      ]
    },
    "entries": {
      "type": "array",
      "items": {
        "$ref": "#/$defs/DeploymentLogEntry"
      }
    }
  },
  "$defs": {
    "DeploymentLogEntry": {
      "type": "object",
      "required": [
        "id",
        "phase",
        "severity",
        "redacted",
        "truncated",
        "observedAt",
        "createdAt"
      ],
      "properties": {
        "id": {
          "type": "string"
        },
        "phase": {
          "type": "string",
          "enum": [
            "queue",
            "build",
            "deploy",
            "healthcheck",
            "system"
          ]
        },
        "category": {
          "type": [
            "string",
            "null"
          ],
          "enum": [
            "clone_failed",
            "build_failed",
            "image_push_failed",
            "deploy_failed",
            "healthcheck_failed",
            "runtime_startup_failed",
            "runtime_startup_timeout",
            "app_health_failed",
            "route_activation_failed",
            "platform_capacity_failed",
            "invalid_runtime_config",
            "internal_platform_error",
            null
          ]
        },
        "severity": {
          "type": "string",
          "enum": [
            "info",
            "warning",
            "error"
          ]
        },
        "logKind": {
          "type": [
            "string",
            "null"
          ],
          "enum": [
            "build",
            "deploy",
            "runtime",
            "event",
            null
          ]
        },
        "stream": {
          "type": [
            "string",
            "null"
          ],
          "enum": [
            "stdout",
            "stderr",
            "system",
            null
          ]
        },
        "redacted": {
          "type": "boolean"
        },
        "truncated": {
          "type": "boolean"
        },
        "truncationReason": {
          "type": [
            "string",
            "null"
          ]
        },
        "observedAt": {
          "type": "string",
          "format": "date-time"
        },
        "message": {
          "type": [
            "string",
            "null"
          ]
        },
        "providerReady": {
          "type": [
            "boolean",
            "null"
          ]
        },
        "gatewayStatusCode": {
          "type": [
            "integer",
            "null"
          ],
          "minimum": 100,
          "maximum": 599
        },
        "gatewayRouteMatched": {
          "type": [
            "boolean",
            "null"
          ]
        },
        "gatewayAppRespondedOk": {
          "type": [
            "boolean",
            "null"
          ]
        },
        "gatewayTlsOk": {
          "type": [
            "boolean",
            "null"
          ]
        },
        "probeAttempts": {
          "type": [
            "integer",
            "null"
          ],
          "minimum": 0,
          "maximum": 100
        },
        "createdAt": {
          "type": "string",
          "format": "date-time"
        }
      }
    },
    "DeploymentLogRetention": {
      "type": "object",
      "required": [
        "expiredLogKinds",
        "expiredErrorLogKinds"
      ],
      "properties": {
        "expiredLogKinds": {
          "type": "array",
          "uniqueItems": true,
          "maxItems": 4,
          "items": {
            "type": "string",
            "enum": [
              "build",
              "deploy",
              "runtime",
              "event"
            ]
          }
        },
        "expiredErrorLogKinds": {
          "type": "array",
          "uniqueItems": true,
          "maxItems": 4,
          "items": {
            "type": "string",
            "enum": [
              "build",
              "deploy",
              "runtime",
              "event"
            ]
          }
        }
      }
    },
    "DeploymentLogStreamState": {
      "type": "string",
      "enum": [
        "live",
        "reconnecting",
        "catching_up",
        "delayed",
        "completed",
        "blocked"
      ]
    },
    "DeploymentLogStreamStateByKind": {
      "type": "object",
      "required": [
        "event",
        "build",
        "deploy",
        "runtime"
      ],
      "properties": {
        "event": {
          "$ref": "#/$defs/DeploymentLogStreamState"
        },
        "build": {
          "$ref": "#/$defs/DeploymentLogStreamState"
        },
        "deploy": {
          "$ref": "#/$defs/DeploymentLogStreamState"
        },
        "runtime": {
          "$ref": "#/$defs/DeploymentLogStreamState"
        }
      }
    },
    "RuntimeLogState": {
      "type": "object",
      "required": [
        "status",
        "reason",
        "checkedAt",
        "lastSuccessAt"
      ],
      "properties": {
        "status": {
          "type": "string",
          "enum": [
            "ready",
            "empty",
            "blocked",
            "delayed",
            "failed",
            "unavailable"
          ]
        },
        "reason": {
          "type": [
            "string",
            "null"
          ],
          "enum": [
            "runtime-log-access-blocked",
            "runtime-log-collection-delayed",
            "runtime-log-collection-failed",
            "runtime-log-source-unavailable",
            null
          ]
        },
        "checkedAt": {
          "type": [
            "string",
            "null"
          ],
          "format": "date-time"
        },
        "lastSuccessAt": {
          "type": [
            "string",
            "null"
          ],
          "format": "date-time"
        }
      }
    }
  }
}