{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "title": "Enerplain synthetic missing-is-not-zero example, version 1",
  "description": "Shape of a teaching fixture, not a production data-validation contract.",
  "type": "object",
  "required": ["schemaVersion", "synthetic", "description", "contract", "sourceRecords", "applicationRecords", "expectedFinding"],
  "additionalProperties": false,
  "properties": {
    "schemaVersion": {"const": "1.0.0"},
    "synthetic": {"const": true},
    "description": {"type": "string"},
    "contract": {
      "type": "object",
      "required": ["deviceId", "metric", "unit", "timestampMeaning", "intervalMinutes", "windowStart", "windowEndExclusive", "displayTimeZone", "expectedReporting"],
      "additionalProperties": false,
      "properties": {
        "deviceId": {"const": "fictional-device-01"},
        "metric": {"const": "interval_energy"},
        "unit": {"const": "kWh"},
        "timestampMeaning": {"const": "interval_start"},
        "intervalMinutes": {"const": 15},
        "windowStart": {"const": "2026-10-25T00:00:00Z"},
        "windowEndExclusive": {"const": "2026-10-25T02:00:00Z"},
        "displayTimeZone": {"const": "Europe/Warsaw"},
        "expectedReporting": {"type": "string"}
      }
    },
    "sourceRecords": {"type": "array", "items": {"$ref": "#/$defs/record"}},
    "applicationRecords": {"type": "array", "items": {"$ref": "#/$defs/record"}},
    "expectedFinding": {
      "type": "object",
      "required": ["code", "intervalStart", "observedSourceSubtotalKwh", "completeSourceWindowTotalKwh", "limitation"],
      "additionalProperties": false,
      "properties": {
        "code": {"const": "ABSENCE_FILLED_WITH_ZERO"},
        "intervalStart": {"const": "2026-10-25T00:30:00Z"},
        "observedSourceSubtotalKwh": {"const": 0},
        "completeSourceWindowTotalKwh": {"type": "null"},
        "limitation": {"type": "string"}
      }
    }
  },
  "$defs": {
    "record": {
      "type": "object", "required": ["intervalStart", "energyKwh"], "additionalProperties": false,
      "properties": {
        "intervalStart": {"type": "string", "format": "date-time"},
        "energyKwh": {"type": "number"}
      }
    }
  }
}
