{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/perigeetides-com/json-schema/perigeetides-com-trip-health-decision-schema.json",
  "title": "TripHealthDecision",
  "x-generated": "2026-11-20",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/perigeetides-com-openapi.json#/components/schemas/TripHealthDecision",
  "type": "object",
  "required": [
    "contractVersion",
    "kind",
    "decisionId",
    "evaluatedAt",
    "requestedFor",
    "state",
    "confidence",
    "reasons",
    "sources",
    "disclaimer"
  ],
  "properties": {
    "contractVersion": {
      "type": "string"
    },
    "kind": {
      "const": "trip-health"
    },
    "decisionId": {
      "type": "string",
      "format": "uuid"
    },
    "evaluatedAt": {
      "type": "string",
      "format": "date-time"
    },
    "requestedFor": {
      "type": "string",
      "format": "date-time"
    },
    "state": {
      "type": "string",
      "enum": [
        "normal",
        "watch",
        "action-needed",
        "unknown"
      ]
    },
    "confidence": {
      "type": "string",
      "enum": [
        "high",
        "moderate",
        "low"
      ]
    },
    "headline": {
      "type": "string"
    },
    "summary": {
      "type": "string"
    },
    "reasons": {
      "type": "array",
      "items": {
        "type": "object",
        "additionalProperties": true
      }
    },
    "missingInputs": {
      "type": "array",
      "items": {
        "type": "string"
      }
    },
    "sources": {
      "type": "array",
      "items": {
        "$ref": "#/$defs/DecisionSource"
      }
    },
    "disclaimer": {
      "type": "string"
    }
  },
  "$defs": {
    "DecisionSource": {
      "type": "object",
      "required": [
        "id",
        "label",
        "provider",
        "kind",
        "required",
        "available",
        "freshness",
        "receivedAt",
        "attributionUrl"
      ],
      "properties": {
        "id": {
          "type": "string"
        },
        "label": {
          "type": "string"
        },
        "provider": {
          "type": "string",
          "enum": [
            "NOAA CO-OPS",
            "National Weather Service",
            "Perigee"
          ]
        },
        "kind": {
          "type": "string",
          "enum": [
            "prediction",
            "observation",
            "forecast",
            "calculation"
          ]
        },
        "required": {
          "type": "boolean"
        },
        "available": {
          "type": "boolean"
        },
        "freshness": {
          "type": "string",
          "enum": [
            "fresh",
            "aging",
            "stale",
            "unknown"
          ]
        },
        "sourceAt": {
          "type": [
            "string",
            "null"
          ],
          "format": "date-time"
        },
        "receivedAt": {
          "type": "string",
          "format": "date-time"
        },
        "ageMinutes": {
          "type": [
            "integer",
            "null"
          ]
        },
        "attributionUrl": {
          "type": "string",
          "format": "uri"
        }
      }
    }
  }
}