{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/signdocs-com-br/json-schema/signdocs-com-br-health-history-response-schema.json",
  "title": "HealthHistoryResponse",
  "description": "Resposta com histórico de saúde da API.",
  "x-generated": "2026-11-10",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/signdocs-com-br-health-api-openapi.yml#/components/schemas/HealthHistoryResponse",
  "type": "object",
  "required": [
    "period",
    "from",
    "to",
    "totalChecks",
    "uptime",
    "incidents"
  ],
  "properties": {
    "period": {
      "type": "string",
      "description": "Período consultado.",
      "enum": [
        "24h",
        "7d",
        "30d"
      ]
    },
    "from": {
      "type": "string",
      "format": "date-time",
      "description": "Início do período."
    },
    "to": {
      "type": "string",
      "format": "date-time",
      "description": "Fim do período."
    },
    "totalChecks": {
      "type": "integer",
      "description": "Total de verificações no período."
    },
    "uptime": {
      "type": "object",
      "description": "Percentual de disponibilidade por componente.",
      "properties": {
        "overall": {
          "type": "number",
          "description": "Uptime geral (0-100)."
        },
        "dynamodb": {
          "type": "number"
        },
        "s3": {
          "type": "number"
        },
        "kms": {
          "type": "number"
        },
        "mtlsTruststore": {
          "type": "number"
        }
      }
    },
    "incidents": {
      "type": "array",
      "description": "Incidentes no período.",
      "items": {
        "type": "object",
        "required": [
          "startedAt",
          "affectedComponents"
        ],
        "properties": {
          "startedAt": {
            "type": "string",
            "format": "date-time"
          },
          "endedAt": {
            "type": "string",
            "format": "date-time"
          },
          "affectedComponents": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "durationMinutes": {
            "type": "number"
          }
        }
      }
    },
    "latestCheck": {
      "type": "object",
      "description": "Última verificação realizada.",
      "properties": {
        "overallStatus": {
          "type": "string"
        },
        "components": {
          "type": "object",
          "properties": {
            "dynamodb": {
              "$ref": "#/$defs/ComponentHealth"
            },
            "s3": {
              "$ref": "#/$defs/ComponentHealth"
            },
            "kms": {
              "$ref": "#/$defs/ComponentHealth"
            },
            "mtlsTruststore": {
              "$ref": "#/$defs/ComponentHealth"
            }
          }
        },
        "checkedAt": {
          "type": "string",
          "format": "date-time"
        },
        "totalLatencyMs": {
          "type": "number"
        }
      }
    }
  },
  "$defs": {
    "ComponentHealth": {
      "type": "object",
      "description": "Status de saúde de um componente individual.",
      "required": [
        "status",
        "latencyMs"
      ],
      "properties": {
        "status": {
          "type": "string",
          "description": "Status operacional do componente.",
          "enum": [
            "operational",
            "down"
          ]
        },
        "latencyMs": {
          "type": "number",
          "description": "Latência da verificação do componente em milissegundos."
        }
      }
    }
  }
}