{
  "$defs": {
    "RawAnticipatedCommitmentHistory": {
      "additionalProperties": false,
      "description": "Past committed MW values for one anticipated thermal plant.\n\n`values_mw[0]` is the commitment for the earliest pending delivery stage;\n`values_mw[k-1]` is the most recent. Length must equal the plant's\n`lead_stages` (validated semantically in a later validation layer).",
      "properties": {
        "thermal_id": {
          "description": "Thermal plant identifier. Must reference an anticipated thermal.",
          "format": "int32",
          "type": "integer"
        },
        "values_mw": {
          "description": "Past committed MW values, ordered by delivery stage ascending.\nLength must equal the plant's `lead_stages` (validated semantically).",
          "items": {
            "format": "double",
            "type": "number"
          },
          "type": "array"
        }
      },
      "required": [
        "thermal_id",
        "values_mw"
      ],
      "type": "object"
    },
    "RawHydroPastInflows": {
      "additionalProperties": false,
      "description": "Past inflow values for PAR(p) lag initialization for one hydro plant.",
      "properties": {
        "hydro_id": {
          "description": "Hydro plant identifier. Must be unique within `past_inflows`.",
          "format": "int32",
          "type": "integer"
        },
        "season_ids": {
          "default": null,
          "description": "Optional season IDs corresponding to each lag entry in `values_m3s`,\none per entry. When present, length must equal `values_m3s.length`.\nEach value must reference a season ID defined in `season_definitions`.\nAbsent from legacy JSON files (backward compatible).",
          "items": {
            "format": "uint32",
            "minimum": 0,
            "type": "integer"
          },
          "type": [
            "array",
            "null"
          ]
        },
        "values_m3s": {
          "description": "Past inflow values [m³/s], ordered from most recent (lag 1, index 0) to\noldest (lag p, index p-1). Must have length >= the hydro's PAR order.",
          "items": {
            "format": "double",
            "type": "number"
          },
          "type": "array"
        }
      },
      "required": [
        "hydro_id",
        "values_m3s"
      ],
      "type": "object"
    },
    "RawHydroStorage": {
      "additionalProperties": false,
      "description": "Initial reservoir volume for one hydro plant, in hm³.",
      "properties": {
        "hydro_id": {
          "description": "Hydro plant identifier. Must be unique within its array.",
          "format": "int32",
          "type": "integer"
        },
        "value_hm3": {
          "description": "Reservoir volume [hm³]. Must be >= 0.0.",
          "format": "double",
          "type": "number"
        }
      },
      "required": [
        "hydro_id",
        "value_hm3"
      ],
      "type": "object"
    },
    "RawRecentObservation": {
      "additionalProperties": false,
      "description": "Observed inflow for a single hydro plant over a specific date range.\n\nUsed to seed the lag accumulator when a study begins mid-season (before the\nfirst lag-period boundary). Each entry covers one hydro over one\nobservation period. Multiple entries per hydro are allowed for rolling\nrevisions.",
      "properties": {
        "end_date": {
          "description": "End of the observation period (exclusive), as an ISO 8601 date\n(YYYY-MM-DD). Must be after `start_date`.",
          "type": "string"
        },
        "hydro_id": {
          "description": "Hydro plant identifier. Must reference a hydro entity in the system.",
          "format": "int32",
          "type": "integer"
        },
        "start_date": {
          "description": "Start of the observation period (inclusive), as an ISO 8601 date\n(YYYY-MM-DD).",
          "type": "string"
        },
        "value_m3s": {
          "description": "Average inflow observed during the period [m³/s]. Must be finite and\nnon-negative.",
          "format": "double",
          "type": "number"
        }
      },
      "required": [
        "hydro_id",
        "start_date",
        "end_date",
        "value_m3s"
      ],
      "type": "object"
    }
  },
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "additionalProperties": false,
  "description": "Initial reservoir storage conditions, past inflow values, and recent\nobservations for all hydro plants in the case.\n\nTwo arrays specify starting volumes at simulation time zero:\n- `storage` — operating hydros (those participating in generation dispatch).\n- `filling_storage` — filling hydros (reservoirs under construction or filling).\n\nAn optional array provides past inflow values for PAR(p) lag initialization:\n- `past_inflows` — ordered from most recent (lag 1) to oldest (lag p).\n\nAn optional array provides observed inflow data for mid-season study starts:\n- `recent_observations` — date-ranged observations that seed the lag accumulator.\n\nA hydro may appear in at most one of the two storage arrays. Duplicate\n`hydro_id` values within the same array are rejected. Cross-reference\nvalidation (checking that IDs exist in the hydro registry) is deferred to\na later validation layer.",
  "properties": {
    "$schema": {
      "description": "JSON schema URI — informational, not validated.",
      "type": [
        "string",
        "null"
      ]
    },
    "filling_storage": {
      "description": "Initial reservoir volumes for filling hydros [hm³].\nA filling hydro may not also appear in `storage`.",
      "items": {
        "$ref": "#/$defs/RawHydroStorage"
      },
      "type": "array"
    },
    "past_anticipated_commitments": {
      "description": "Past committed MW values for each anticipated thermal plant, ordered by\ndelivery stage ascending. Present only when the study includes at least\none anticipated thermal. Optional; defaults to empty.",
      "items": {
        "$ref": "#/$defs/RawAnticipatedCommitmentHistory"
      },
      "type": "array"
    },
    "past_inflows": {
      "description": "Past inflow values for PAR(p) lag initialization [m³/s], one entry per\nhydro. For each hydro, `values_m3s[0]` is the most recent past inflow\n(lag 1) and `values_m3s[p-1]` is the oldest (lag p). Required when\n`inflow_lags` is enabled and the PAR order is > 0. Optional; defaults\nto empty.",
      "items": {
        "$ref": "#/$defs/RawHydroPastInflows"
      },
      "type": "array"
    },
    "recent_observations": {
      "description": "Observed inflow data for partial periods before the study start\n[m³/s per date range per hydro]. Used to seed the lag accumulator when\na study begins mid-season. Date ranges for the same hydro must not\noverlap; adjacent ranges (start == previous end) are accepted.\nOptional; defaults to empty.",
      "items": {
        "$ref": "#/$defs/RawRecentObservation"
      },
      "type": "array"
    },
    "storage": {
      "description": "Initial reservoir volumes for operating hydros [hm³].",
      "items": {
        "$ref": "#/$defs/RawHydroStorage"
      },
      "type": "array"
    }
  },
  "required": [
    "storage",
    "filling_storage"
  ],
  "title": "RawInitialConditions",
  "type": "object"
}