{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/astroletra-com/json-schema/astroletra-com-actividad-solar-schema.json",
  "title": "ActividadSolar",
  "description": "La actividad del Sol en directo, reducida y explicada en castellano. Todas las horas en UTC (ISO 8601).",
  "x-generated": "2026-12-04",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/astroletra-com-openapi.yml#/components/schemas/ActividadSolar",
  "type": "object",
  "required": [
    "updated_at",
    "kp",
    "kp_recent",
    "kp_forecast",
    "scales",
    "aurora_spain",
    "source",
    "license"
  ],
  "properties": {
    "updated_at": {
      "type": "string",
      "format": "date-time",
      "description": "Hora de la última lectura de la NOAA."
    },
    "kp": {
      "type": "object",
      "description": "Índice Kp planetario, el estimado del último minuto y el último valor de 3 horas, con su nivel de la escala G (0 sin tormenta, 1 a 5 de G1 a G5).",
      "properties": {
        "now": {
          "type": [
            "number",
            "null"
          ]
        },
        "now_time": {
          "type": [
            "string",
            "null"
          ]
        },
        "last_3h": {
          "type": [
            "number",
            "null"
          ]
        },
        "last_3h_time": {
          "type": [
            "string",
            "null"
          ]
        },
        "g": {
          "type": "integer"
        },
        "g_label": {
          "type": "string"
        },
        "stale": {
          "type": "boolean"
        }
      }
    },
    "kp_recent": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "time": {
            "type": "string",
            "format": "date-time"
          },
          "kp": {
            "type": "number"
          },
          "g": {
            "type": "integer",
            "minimum": 0,
            "maximum": 5
          }
        }
      },
      "description": "El Kp de 3 horas de los últimos días."
    },
    "kp_forecast": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "time": {
            "type": "string",
            "format": "date-time"
          },
          "kp": {
            "type": "number"
          },
          "g": {
            "type": "integer",
            "minimum": 0,
            "maximum": 5
          }
        }
      },
      "description": "La previsión de Kp de la NOAA para los próximos tres días, por bloques de 3 horas."
    },
    "scales": {
      "type": "object",
      "description": "Escalas de la NOAA, R (apagones de radio), S (tormentas de radiación) y G (tormentas geomagnéticas), ahora y su previsión de tres días.",
      "properties": {
        "now": {
          "type": "object",
          "properties": {
            "r": {
              "type": "integer"
            },
            "s": {
              "type": "integer"
            },
            "g": {
              "type": "integer"
            }
          }
        },
        "forecast": {
          "type": "array",
          "items": {
            "type": "object",
            "properties": {
              "date": {
                "type": "string",
                "format": "date"
              },
              "r_minor_prob": {
                "type": [
                  "number",
                  "null"
                ]
              },
              "r_major_prob": {
                "type": [
                  "number",
                  "null"
                ]
              },
              "s_prob": {
                "type": [
                  "number",
                  "null"
                ]
              },
              "g": {
                "type": "integer"
              }
            }
          }
        },
        "stale": {
          "type": "boolean"
        }
      }
    },
    "solar_wind": {
      "type": "object",
      "description": "Viento solar en el punto L1, con la velocidad en km/s y el campo magnético (Bt y Bz) en nanoteslas.",
      "properties": {
        "time": {
          "type": [
            "string",
            "null"
          ]
        },
        "speed_km_s": {
          "type": [
            "number",
            "null"
          ]
        },
        "bt_nt": {
          "type": [
            "number",
            "null"
          ]
        },
        "bz_nt": {
          "type": [
            "number",
            "null"
          ]
        },
        "stale": {
          "type": "boolean"
        }
      }
    },
    "xray": {
      "type": [
        "object",
        "null"
      ],
      "description": "Flujo de rayos X del satélite GOES, con su clase (A, B, C, M o X) y el pico de las últimas 6 horas."
    },
    "alerts": {
      "type": "array",
      "description": "Alertas, avisos y vigilancias en vigor, con su código de la NOAA, el titular en inglés tal cual y una etiqueta en castellano.",
      "items": {
        "type": "object",
        "properties": {
          "issued": {
            "type": "string",
            "format": "date-time"
          },
          "code": {
            "type": "string"
          },
          "type": {
            "type": "string"
          },
          "label": {
            "type": "string"
          },
          "headline": {
            "type": "string"
          }
        }
      }
    },
    "aurora": {
      "type": "object",
      "description": "Modelo OVATION de la NOAA reducido a Europa, con la probabilidad máxima, la latitud más baja con un 10 % y la rejilla [longitud, latitud, probabilidad %] del norte."
    },
    "aurora_spain": {
      "type": "object",
      "description": "Qué Kp hace falta para ver auroras en el norte, el centro y el sur de España, y si se alcanza ahora o en las próximas 24 horas. Es una regla de Astroletra, no un umbral oficial.",
      "properties": {
        "rule": {
          "type": "string"
        },
        "kp_max_next_24h": {
          "type": [
            "number",
            "null"
          ]
        },
        "zones": {
          "type": "array",
          "items": {
            "type": "object",
            "properties": {
              "zone": {
                "type": "string",
                "enum": [
                  "north",
                  "centre",
                  "south"
                ]
              },
              "label": {
                "type": "string"
              },
              "geomag_lat": {
                "type": "number"
              },
              "kp_needed": {
                "type": "number"
              },
              "now": {
                "type": "boolean"
              },
              "next_24h": {
                "type": "boolean"
              }
            }
          }
        }
      }
    },
    "stale_parts": {
      "type": "array",
      "items": {
        "type": "string"
      },
      "description": "Partes que no se pudieron renovar en la última lectura y se sirven con el valor anterior."
    },
    "source": {
      "type": "string"
    },
    "license": {
      "type": "string"
    },
    "license_url": {
      "type": "string"
    },
    "docs": {
      "type": "string"
    }
  }
}