{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://schema.nfh.global/EnergyResourceStorage/v1.1",
  "title": "EnergyResourceStorage",
  "description": "Typed schema for stationary battery energy storage resources (BESS). v1.1: storageCapacityKwh → storageCapacity (QuantitativeValue); inherits EnergyResourceCommon/v1.1. CIM: cim:BatteryUnit (IEC 61970-302). BATTERY is a deprecated alias for BESS. Optional admin field roundTripEfficiencyPct carries AC-to-AC round-trip efficiency per IEC 62933-2-1.",
  "allOf": [
    { "$ref": "https://schema.nfh.global/EnergyResourceCommon/v1.1#EnergyResourceCommon" },
    {
      "type": "object",
      "required": ["id", "type"],
      "properties": {
        "type": {
          "type": "string",
          "enum": ["BESS", "BATTERY"],
          "description": "Asset-class discriminator. BATTERY is deprecated; use BESS. CIM: cim:BatteryUnit (IEC 61970-302)."
        },
        "attributes": { "$ref": "#/$defs/EnergyResourceStorageAttributes" }
      }
    }
  ],
  "$defs": {
    "EnergyResourceStorageAttributes": {
      "allOf": [
        { "$ref": "https://schema.nfh.global/EnergyResourceCommon/v1.1#EnergyResourceCommonAttributes" },
        {
          "type": "object",
          "additionalProperties": true,
          "properties": {
            "storageCapacity": {
              "$ref": "https://schema.nfh.global/EnergyResourceCommon/v1.1#QVEnergy",
              "description": "Rated stored-energy capacity. unit: kWh | MWh. CIM: BatteryUnit.ratedE."
            },
            "storageType": {
              "type": "string",
              "enum": ["LithiumIon", "LeadAcid", "FlowBattery", "NaS", "NiCd", "Flywheel", "Other"],
              "description": "Battery storage technology type."
            },
            "stateOfHealthPct": {
              "type": "number",
              "minimum": 0,
              "maximum": 100,
              "description": "Battery state-of-health as a percentage (0–100)."
            },
            "roundTripEfficiencyPct": {
              "type": "number",
              "minimum": 0,
              "maximum": 100,
              "description": "AC-to-AC round-trip efficiency (0–100). Energy returned to grid / energy drawn over a full charge/discharge cycle. IEC 62933-2-1. Distinct from stateOfHealthPct."
            }
          }
        }
      ]
    }
  }
}
