{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/eurobase-dev/json-schema/eurobase-dev-function-project-logs-response-schema.json",
  "title": "FunctionProjectLogsResponse",
  "x-generated": "2026-11-10",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/eurobase-dev-functions-api-openapi.yml#/components/schemas/FunctionProjectLogsResponse",
  "type": "object",
  "required": [
    "project",
    "function",
    "filters",
    "retentionPolicy",
    "entries",
    "nextCursor"
  ],
  "properties": {
    "project": {
      "$ref": "#/$defs/ProjectSummary"
    },
    "function": {
      "$ref": "#/$defs/FunctionAsset"
    },
    "filters": {
      "type": "object",
      "required": [
        "severity",
        "category",
        "timeRange"
      ],
      "properties": {
        "severity": {
          "type": [
            "string",
            "null"
          ],
          "enum": [
            "info",
            "warning",
            "error",
            null
          ]
        },
        "category": {
          "type": [
            "string",
            "null"
          ]
        },
        "timeRange": {
          "type": "string",
          "enum": [
            "30m",
            "6h",
            "24h",
            "7d"
          ]
        }
      }
    },
    "retentionPolicy": {
      "type": "object",
      "required": [
        "maxEntriesPerCategory",
        "maxAgeDays"
      ],
      "properties": {
        "maxEntriesPerCategory": {
          "type": "integer"
        },
        "maxAgeDays": {
          "type": "integer"
        }
      }
    },
    "entries": {
      "type": "array",
      "items": {
        "$ref": "#/$defs/ProjectLogEntry"
      }
    },
    "nextCursor": {
      "type": [
        "string",
        "null"
      ]
    }
  },
  "$defs": {
    "FunctionActionAvailability": {
      "type": "object",
      "required": [
        "canDeploy",
        "blockedReason",
        "recoveryAction",
        "targetFunctionId"
      ],
      "additionalProperties": false,
      "properties": {
        "canDeploy": {
          "type": "boolean"
        },
        "blockedReason": {
          "type": [
            "string",
            "null"
          ],
          "enum": [
            "not-authorized",
            "project-pending-delete",
            "function-deploy-in-flight",
            "function-deleted",
            "function-cron-metering-unavailable",
            "project-provider-access-not-ready",
            null
          ]
        },
        "recoveryAction": {
          "type": [
            "string",
            "null"
          ],
          "enum": [
            "open_settings",
            null
          ]
        },
        "targetFunctionId": {
          "type": [
            "string",
            "null"
          ]
        }
      }
    },
    "FunctionAsset": {
      "type": "object",
      "description": "Role-authorized function fields. Internal query aliases, deployment source copies and raw provider metadata are not exposed.",
      "required": [
        "id",
        "organizationId",
        "projectId",
        "name",
        "sourceMode",
        "entryPath",
        "runtime",
        "triggerType",
        "authMode",
        "authModeLabel",
        "deploymentCount",
        "status",
        "statusLabel",
        "actionAvailability",
        "routeConvergence",
        "createdByUserId",
        "createdAt",
        "updatedAt"
      ],
      "properties": {
        "id": {
          "type": "string"
        },
        "organizationId": {
          "type": "string"
        },
        "projectId": {
          "type": "string"
        },
        "name": {
          "type": "string"
        },
        "sourceMode": {
          "type": "string",
          "enum": [
            "managed",
            "git"
          ]
        },
        "entryPath": {
          "type": "string"
        },
        "sourceFiles": {
          "description": "Present for project owners/admins. Omitted from contributor-readable function payloads.",
          "type": "array",
          "items": {
            "$ref": "#/$defs/FunctionSourceFile"
          }
        },
        "runtime": {
          "type": "string",
          "enum": [
            "deno_ts"
          ]
        },
        "triggerType": {
          "type": "string",
          "enum": [
            "http",
            "cron"
          ]
        },
        "authMode": {
          "type": "string",
          "enum": [
            "public",
            "signed"
          ]
        },
        "authModeLabel": {
          "type": "string"
        },
        "deploymentCount": {
          "type": "integer"
        },
        "cronSchedule": {
          "type": [
            "string",
            "null"
          ]
        },
        "status": {
          "type": "string",
          "enum": [
            "draft",
            "deploying",
            "ready",
            "failed",
            "deleted"
          ]
        },
        "statusLabel": {
          "type": "string"
        },
        "route": {
          "oneOf": [
            {
              "$ref": "#/$defs/FunctionRoute"
            },
            {
              "type": "null"
            }
          ]
        },
        "activeDeploymentId": {
          "type": [
            "string",
            "null"
          ]
        },
        "actionAvailability": {
          "$ref": "#/$defs/FunctionActionAvailability"
        },
        "routeConvergence": {
          "$ref": "#/$defs/FunctionRouteConvergence"
        },
        "latestDeployment": {
          "oneOf": [
            {
              "$ref": "#/$defs/FunctionDeployment"
            },
            {
              "type": "null"
            }
          ]
        },
        "createdByUserId": {
          "type": "string"
        },
        "createdAt": {
          "type": "string",
          "format": "date-time"
        },
        "updatedAt": {
          "type": "string",
          "format": "date-time"
        }
      }
    },
    "FunctionDeployment": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "id",
        "organizationId",
        "projectId",
        "functionId",
        "sourceType",
        "status",
        "statusLabel",
        "createdByUserId",
        "createdAt",
        "updatedAt"
      ],
      "properties": {
        "id": {
          "type": "string"
        },
        "organizationId": {
          "type": "string"
        },
        "projectId": {
          "type": "string"
        },
        "functionId": {
          "type": "string"
        },
        "sourceType": {
          "type": "string",
          "enum": [
            "managed",
            "git"
          ]
        },
        "packageRef": {
          "type": [
            "string",
            "null"
          ]
        },
        "status": {
          "type": "string",
          "enum": [
            "queued",
            "deploying",
            "ready",
            "failed"
          ]
        },
        "statusLabel": {
          "type": "string"
        },
        "lastError": {
          "type": [
            "string",
            "null"
          ]
        },
        "createdByUserId": {
          "type": "string"
        },
        "createdAt": {
          "type": "string",
          "format": "date-time"
        },
        "updatedAt": {
          "type": "string",
          "format": "date-time"
        }
      }
    },
    "FunctionRoute": {
      "type": "object",
      "required": [
        "status",
        "statusLabel",
        "accessMode",
        "reasonCode",
        "statusMessage"
      ],
      "properties": {
        "hostname": {
          "type": [
            "string",
            "null"
          ]
        },
        "path": {
          "type": [
            "string",
            "null"
          ]
        },
        "productUrl": {
          "type": [
            "string",
            "null"
          ],
          "format": "uri"
        },
        "accessMode": {
          "type": "string",
          "enum": [
            "public",
            "private"
          ]
        },
        "status": {
          "type": "string",
          "enum": [
            "pending",
            "ready",
            "failed"
          ]
        },
        "statusLabel": {
          "type": "string"
        },
        "reasonCode": {
          "type": "string"
        },
        "statusMessage": {
          "type": "string"
        }
      }
    },
    "FunctionRouteConvergence": {
      "type": "object",
      "required": [
        "state",
        "reasonCode",
        "statusLabel",
        "statusMessage",
        "pollRecommended"
      ],
      "additionalProperties": false,
      "properties": {
        "state": {
          "type": "string",
          "enum": [
            "idle",
            "deploying",
            "route_pending",
            "access_pending",
            "proof_pending",
            "ready",
            "failed"
          ]
        },
        "reasonCode": {
          "type": "string"
        },
        "statusLabel": {
          "type": "string"
        },
        "statusMessage": {
          "type": "string"
        },
        "pollRecommended": {
          "type": "boolean"
        }
      }
    },
    "FunctionSourceFile": {
      "type": "object",
      "required": [
        "path",
        "content"
      ],
      "properties": {
        "path": {
          "type": "string"
        },
        "content": {
          "type": "string"
        }
      }
    },
    "ProjectLogEntry": {
      "type": "object",
      "required": [
        "id",
        "assetType",
        "assetId",
        "severity",
        "category",
        "eventType",
        "message",
        "redacted",
        "truncated",
        "payloadSummary",
        "observedAt",
        "ingestedAt"
      ],
      "properties": {
        "id": {
          "type": "string"
        },
        "assetType": {
          "type": "string",
          "enum": [
            "app",
            "service",
            "function",
            "deployment",
            "container",
            "runtime",
            "storage",
            "static"
          ]
        },
        "assetId": {
          "type": "string"
        },
        "assetName": {
          "type": [
            "string",
            "null"
          ]
        },
        "deploymentId": {
          "type": [
            "string",
            "null"
          ]
        },
        "severity": {
          "type": "string",
          "enum": [
            "info",
            "warning",
            "error"
          ]
        },
        "logKind": {
          "type": [
            "string",
            "null"
          ],
          "enum": [
            "build",
            "deploy",
            "runtime",
            "network",
            "event",
            null
          ]
        },
        "stream": {
          "type": [
            "string",
            "null"
          ],
          "enum": [
            "stdout",
            "stderr",
            "system",
            null
          ]
        },
        "source": {
          "type": [
            "string",
            "null"
          ],
          "enum": [
            "builder",
            "runner",
            "deploy",
            "health",
            "gateway",
            "runtime",
            "api",
            "storage",
            "function",
            null
          ]
        },
        "category": {
          "type": "string"
        },
        "eventType": {
          "type": [
            "string",
            "null"
          ]
        },
        "message": {
          "type": "string"
        },
        "redacted": {
          "type": "boolean"
        },
        "truncated": {
          "type": "boolean"
        },
        "truncationReason": {
          "type": [
            "string",
            "null"
          ]
        },
        "payloadSummary": {
          "type": [
            "string",
            "null"
          ]
        },
        "requestId": {
          "type": [
            "string",
            "null"
          ]
        },
        "method": {
          "type": [
            "string",
            "null"
          ]
        },
        "requestTarget": {
          "type": [
            "string",
            "null"
          ],
          "maxLength": 8000
        },
        "pathClass": {
          "type": [
            "string",
            "null"
          ]
        },
        "statusCode": {
          "type": [
            "integer",
            "null"
          ]
        },
        "statusClass": {
          "type": [
            "string",
            "null"
          ]
        },
        "latencyMs": {
          "type": [
            "integer",
            "null"
          ]
        },
        "sourceIp": {
          "type": [
            "string",
            "null"
          ]
        },
        "sourceGeo": {
          "$ref": "#/$defs/ProjectLogSourceGeo"
        },
        "sourceNetworkHash": {
          "type": [
            "string",
            "null"
          ]
        },
        "userAgentFamily": {
          "type": [
            "string",
            "null"
          ]
        },
        "userAgent": {
          "type": [
            "string",
            "null"
          ],
          "maxLength": 256
        },
        "refererHost": {
          "type": [
            "string",
            "null"
          ],
          "maxLength": 253
        },
        "responseBytes": {
          "type": [
            "integer",
            "null"
          ],
          "minimum": 0
        },
        "reason": {
          "type": [
            "string",
            "null"
          ]
        },
        "blocked": {
          "type": [
            "object",
            "null"
          ],
          "description": "A grouped Mini WAF block row (ADR 0109): its exact count, first time, most active client IPs and user-agent families. Kind path is one URL; urls is several URLs of one scope, minute and method, named in urls (most blocked first, at most 50) with their exact distinct count; not_recorded is blocks the Gateway counted but could not record.",
          "required": [
            "kind",
            "count",
            "firstObservedAt",
            "distinctIps",
            "ips",
            "userAgentFamilies",
            "distinctUrls",
            "urls"
          ],
          "properties": {
            "kind": {
              "type": "string",
              "enum": [
                "path",
                "urls",
                "not_recorded"
              ]
            },
            "distinctUrls": {
              "type": [
                "integer",
                "null"
              ],
              "minimum": 1
            },
            "urls": {
              "type": "array",
              "maxItems": 50,
              "items": {
                "type": "object",
                "required": [
                  "url",
                  "count"
                ],
                "properties": {
                  "url": {
                    "type": "string"
                  },
                  "count": {
                    "type": "integer",
                    "minimum": 0
                  }
                }
              }
            },
            "count": {
              "type": "integer",
              "minimum": 1
            },
            "firstObservedAt": {
              "type": [
                "string",
                "null"
              ],
              "format": "date-time"
            },
            "distinctIps": {
              "type": "integer",
              "minimum": 0
            },
            "ips": {
              "type": "array",
              "maxItems": 50,
              "items": {
                "type": "object",
                "required": [
                  "ip",
                  "count"
                ],
                "properties": {
                  "ip": {
                    "type": "string"
                  },
                  "count": {
                    "type": "integer",
                    "minimum": 0
                  }
                }
              }
            },
            "userAgentFamilies": {
              "type": "array",
              "items": {
                "type": "object",
                "required": [
                  "family",
                  "count"
                ],
                "properties": {
                  "family": {
                    "type": "string",
                    "enum": [
                      "Chrome",
                      "Firefox",
                      "Safari",
                      "curl",
                      "bot",
                      "other",
                      "unknown"
                    ]
                  },
                  "count": {
                    "type": "integer",
                    "minimum": 1
                  }
                }
              }
            }
          }
        },
        "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
        },
        "observedAt": {
          "type": "string",
          "format": "date-time"
        },
        "ingestedAt": {
          "type": "string",
          "format": "date-time"
        }
      }
    },
    "ProjectLogSourceGeo": {
      "type": [
        "object",
        "null"
      ],
      "required": [
        "label",
        "countryCode",
        "country",
        "regionCode",
        "region",
        "city"
      ],
      "properties": {
        "label": {
          "type": "string"
        },
        "countryCode": {
          "type": "string"
        },
        "country": {
          "type": "string"
        },
        "regionCode": {
          "type": [
            "string",
            "null"
          ]
        },
        "region": {
          "type": [
            "string",
            "null"
          ]
        },
        "city": {
          "type": [
            "string",
            "null"
          ]
        }
      }
    },
    "ProjectRoute": {
      "type": "object",
      "required": [
        "status",
        "reasonCode",
        "managed",
        "upstream"
      ],
      "properties": {
        "status": {
          "type": "string",
          "enum": [
            "healthy",
            "repairing",
            "degraded",
            "broken",
            "unknown"
          ]
        },
        "reasonCode": {
          "type": "string",
          "enum": [
            "none",
            "dns_record_missing",
            "dns_propagating",
            "domain_binding_missing",
            "tls_pending",
            "missing_project_upstream",
            "upstream_unreachable",
            "ingress_unreachable",
            "unmanaged_custom_domain",
            "scw_mutation_failed"
          ]
        },
        "checkedAt": {
          "type": [
            "string",
            "null"
          ],
          "format": "date-time"
        },
        "lastRepairAt": {
          "type": [
            "string",
            "null"
          ],
          "format": "date-time"
        },
        "lastError": {
          "type": [
            "string",
            "null"
          ]
        },
        "managed": {
          "type": "boolean"
        },
        "convergenceState": {
          "type": [
            "string",
            "null"
          ],
          "enum": [
            "recovering",
            "exhausted",
            "ready",
            null
          ]
        },
        "upstream": {
          "$ref": "#/$defs/ProjectUpstreamState"
        }
      }
    },
    "ProjectServingSuspension": {
      "type": "object",
      "description": "An operator suspension of the project's public serving (ADR 0080). Operator notes and evidence are never included.",
      "required": [
        "state",
        "reasonCategory",
        "reasonLabel",
        "since",
        "supportEmail",
        "policyUrl"
      ],
      "properties": {
        "state": {
          "type": "string",
          "enum": [
            "suspended"
          ]
        },
        "reasonCategory": {
          "type": "string",
          "enum": [
            "phishing",
            "malware",
            "shared_domain_abuse",
            "spam",
            "illegal_content",
            "legal_order",
            "other_policy_violation"
          ]
        },
        "reasonLabel": {
          "type": "string"
        },
        "since": {
          "type": [
            "string",
            "null"
          ],
          "format": "date-time"
        },
        "supportEmail": {
          "type": "string"
        },
        "policyUrl": {
          "type": "string"
        }
      },
      "additionalProperties": false
    },
    "ProjectSourceLock": {
      "type": "object",
      "description": "ADR 0090: while locked, no caller can change the project repository, branch, root directory or deployment mode.",
      "required": [
        "locked",
        "lockedAt"
      ],
      "properties": {
        "locked": {
          "type": "boolean"
        },
        "lockedAt": {
          "type": [
            "string",
            "null"
          ],
          "format": "date-time"
        }
      },
      "additionalProperties": false
    },
    "ProjectSourceProfileSummary": {
      "type": "object",
      "required": [
        "framework",
        "frameworkLabel",
        "outputMode"
      ],
      "properties": {
        "framework": {
          "type": "string",
          "enum": [
            "next",
            "astro",
            "svelte-kit",
            "nuxt",
            "react-router",
            "tanstack-start",
            "vite",
            "hono",
            "nestjs",
            "fastify",
            "express",
            "django",
            "fastapi",
            "flask",
            "laravel",
            "rails",
            "node",
            "python",
            "php",
            "ruby",
            "go",
            "java",
            "dotnet",
            "static"
          ]
        },
        "frameworkLabel": {
          "type": "string"
        },
        "outputMode": {
          "type": "string",
          "enum": [
            "runtime",
            "static"
          ]
        }
      }
    },
    "ProjectSummary": {
      "type": "object",
      "required": [
        "id",
        "deploymentMode",
        "projectRoute",
        "releaseUsability",
        "sourceProfile"
      ],
      "properties": {
        "id": {
          "type": "string"
        },
        "name": {
          "type": [
            "string",
            "null"
          ]
        },
        "organizationId": {
          "type": [
            "string",
            "null"
          ]
        },
        "projectMembershipId": {
          "type": [
            "string",
            "null"
          ]
        },
        "projectRole": {
          "type": [
            "string",
            "null"
          ],
          "enum": [
            "owner",
            "admin",
            "contributor",
            null
          ]
        },
        "projectSlug": {
          "type": [
            "string",
            "null"
          ]
        },
        "projectHostname": {
          "type": [
            "string",
            "null"
          ]
        },
        "primaryHostname": {
          "type": [
            "string",
            "null"
          ],
          "description": "Official address of the project: its active custom domain whose DNS points at Eurobase, the one that went live first when several do, otherwise projectHostname. projectHostname stays reserved and keeps serving."
        },
        "deploymentMode": {
          "type": "string",
          "enum": [
            "runtime",
            "static"
          ]
        },
        "lifecycleState": {
          "type": [
            "string",
            "null"
          ]
        },
        "deleteRequestedAt": {
          "type": [
            "string",
            "null"
          ],
          "format": "date-time"
        },
        "projectRoute": {
          "$ref": "#/$defs/ProjectRoute"
        },
        "releaseUsability": {
          "$ref": "#/$defs/ReleaseUsability"
        },
        "projectSummaryStatus": {
          "$ref": "#/$defs/ProjectSummaryStatus"
        },
        "servingSuspension": {
          "oneOf": [
            {
              "$ref": "#/$defs/ProjectServingSuspension"
            },
            {
              "type": "null"
            }
          ]
        },
        "sourceProfile": {
          "oneOf": [
            {
              "$ref": "#/$defs/ProjectSourceProfileSummary"
            },
            {
              "type": "null"
            }
          ]
        },
        "sourceLock": {
          "$ref": "#/$defs/ProjectSourceLock"
        }
      }
    },
    "ProjectSummaryStatus": {
      "type": "object",
      "required": [
        "label",
        "tone",
        "code",
        "detailTitle",
        "detail"
      ],
      "properties": {
        "label": {
          "type": "string"
        },
        "tone": {
          "type": "string",
          "enum": [
            "neutral",
            "problem",
            "error"
          ]
        },
        "code": {
          "type": "string",
          "enum": [
            "setup_required",
            "route_issue",
            "deploy_failed",
            "deploy_unhealthy",
            "live_release_blocked",
            "status_check_delayed",
            "deploy_in_progress",
            "rollback_live",
            "healthy",
            "suspended"
          ]
        },
        "detailTitle": {
          "type": [
            "string",
            "null"
          ]
        },
        "detail": {
          "type": [
            "string",
            "null"
          ]
        }
      }
    },
    "ProjectUpstreamState": {
      "type": "object",
      "required": [
        "status",
        "reasonCode"
      ],
      "properties": {
        "status": {
          "type": "string",
          "enum": [
            "healthy",
            "broken",
            "unknown"
          ]
        },
        "reasonCode": {
          "type": "string",
          "enum": [
            "none",
            "missing_project_upstream",
            "upstream_unreachable"
          ]
        },
        "checkedAt": {
          "type": [
            "string",
            "null"
          ],
          "format": "date-time"
        },
        "lastError": {
          "type": [
            "string",
            "null"
          ]
        }
      }
    },
    "ReleaseUsability": {
      "type": "object",
      "required": [
        "status",
        "reasonCode",
        "lastLiveDeploymentId"
      ],
      "properties": {
        "status": {
          "type": "string",
          "enum": [
            "reachable",
            "degraded",
            "blocked",
            "unknown"
          ]
        },
        "reasonCode": {
          "type": "string",
          "enum": [
            "none",
            "missing_live_release",
            "access_not_allowed",
            "route_repair_in_progress",
            "route_incident",
            "project_suspended"
          ]
        },
        "lastLiveDeploymentId": {
          "type": [
            "string",
            "null"
          ]
        }
      }
    }
  }
}