{
  "openapi": "3.1.0",
  "info": {
    "title": "Lighting Electricity Cost API — DRAFT NOT DEPLOYED",
    "version": "0.1.0",
    "description": "Proposed interface only. No hosted endpoint is available."
  },
  "servers": [],
  "x-deployment-status": "draft-not-deployed",
  "paths": {
    "/api/tools/v1/lighting-cost": {
      "post": {
        "operationId": "lightingCost",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/LightingCostRequest"
              },
              "examples": {
                "strip": {
                  "value": {
                    "currency": "USD",
                    "electricityRatePerKwh": 0.2,
                    "baseline": {
                      "groups": [
                        {
                          "name": "LED strip",
                          "power": {
                            "kind": "strip",
                            "lengthM": 5,
                            "powerPerMeterW": 14.4,
                            "driverEfficiencyPercent": 90
                          },
                          "hoursPerDay": 8,
                          "daysPerYear": 365,
                          "standbyInputPowerW": 0
                        }
                      ]
                    }
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Proposed success envelope.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/LightingCostResponse"
                }
              }
            }
          },
          "422": {
            "description": "Proposed validation problem."
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "LightingCostRequest": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "currency",
          "electricityRatePerKwh",
          "baseline"
        ],
        "properties": {
          "currency": {
            "type": "string",
            "enum": [
              "USD",
              "EUR",
              "GBP",
              "CAD",
              "AUD",
              "CNY",
              "JPY",
              "INR",
              "AED"
            ]
          },
          "electricityRatePerKwh": {
            "type": "number",
            "minimum": 0
          },
          "baseline": {
            "type": "object",
            "additionalProperties": false,
            "required": [
              "groups"
            ],
            "properties": {
              "groups": {
                "type": "array",
                "minItems": 1,
                "maxItems": 20,
                "items": {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "name",
                    "power",
                    "hoursPerDay",
                    "daysPerYear",
                    "standbyInputPowerW"
                  ],
                  "properties": {
                    "name": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 60
                    },
                    "power": {
                      "oneOf": [
                        {
                          "type": "object",
                          "additionalProperties": false,
                          "required": [
                            "kind",
                            "lengthM",
                            "powerPerMeterW",
                            "driverEfficiencyPercent"
                          ],
                          "properties": {
                            "kind": {
                              "const": "strip"
                            },
                            "lengthM": {
                              "type": "number",
                              "exclusiveMinimum": 0
                            },
                            "powerPerMeterW": {
                              "type": "number",
                              "exclusiveMinimum": 0
                            },
                            "driverEfficiencyPercent": {
                              "oneOf": [
                                {
                                  "type": "number",
                                  "exclusiveMinimum": 0,
                                  "maximum": 100
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            }
                          }
                        },
                        {
                          "type": "object",
                          "additionalProperties": false,
                          "required": [
                            "kind",
                            "inputPowerEachW",
                            "quantity"
                          ],
                          "properties": {
                            "kind": {
                              "const": "fixtures"
                            },
                            "inputPowerEachW": {
                              "type": "number",
                              "exclusiveMinimum": 0
                            },
                            "quantity": {
                              "type": "integer",
                              "minimum": 1
                            }
                          }
                        },
                        {
                          "type": "object",
                          "additionalProperties": false,
                          "required": [
                            "kind",
                            "inputPowerW"
                          ],
                          "properties": {
                            "kind": {
                              "const": "measured"
                            },
                            "inputPowerW": {
                              "type": "number",
                              "minimum": 0
                            }
                          }
                        }
                      ]
                    },
                    "hoursPerDay": {
                      "type": "number",
                      "minimum": 0,
                      "maximum": 24
                    },
                    "daysPerYear": {
                      "type": "number",
                      "minimum": 0,
                      "maximum": 365
                    },
                    "standbyInputPowerW": {
                      "type": "number",
                      "minimum": 0
                    }
                  }
                }
              }
            }
          },
          "comparison": {
            "type": "object",
            "additionalProperties": false,
            "required": [
              "groups",
              "additionalInvestment"
            ],
            "properties": {
              "groups": {
                "type": "array",
                "minItems": 1,
                "maxItems": 20,
                "items": {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "name",
                    "power",
                    "hoursPerDay",
                    "daysPerYear",
                    "standbyInputPowerW"
                  ],
                  "properties": {
                    "name": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 60
                    },
                    "power": {
                      "oneOf": [
                        {
                          "type": "object",
                          "additionalProperties": false,
                          "required": [
                            "kind",
                            "lengthM",
                            "powerPerMeterW",
                            "driverEfficiencyPercent"
                          ],
                          "properties": {
                            "kind": {
                              "const": "strip"
                            },
                            "lengthM": {
                              "type": "number",
                              "exclusiveMinimum": 0
                            },
                            "powerPerMeterW": {
                              "type": "number",
                              "exclusiveMinimum": 0
                            },
                            "driverEfficiencyPercent": {
                              "oneOf": [
                                {
                                  "type": "number",
                                  "exclusiveMinimum": 0,
                                  "maximum": 100
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            }
                          }
                        },
                        {
                          "type": "object",
                          "additionalProperties": false,
                          "required": [
                            "kind",
                            "inputPowerEachW",
                            "quantity"
                          ],
                          "properties": {
                            "kind": {
                              "const": "fixtures"
                            },
                            "inputPowerEachW": {
                              "type": "number",
                              "exclusiveMinimum": 0
                            },
                            "quantity": {
                              "type": "integer",
                              "minimum": 1
                            }
                          }
                        },
                        {
                          "type": "object",
                          "additionalProperties": false,
                          "required": [
                            "kind",
                            "inputPowerW"
                          ],
                          "properties": {
                            "kind": {
                              "const": "measured"
                            },
                            "inputPowerW": {
                              "type": "number",
                              "minimum": 0
                            }
                          }
                        }
                      ]
                    },
                    "hoursPerDay": {
                      "type": "number",
                      "minimum": 0,
                      "maximum": 24
                    },
                    "daysPerYear": {
                      "type": "number",
                      "minimum": 0,
                      "maximum": 365
                    },
                    "standbyInputPowerW": {
                      "type": "number",
                      "minimum": 0
                    }
                  }
                }
              },
              "additionalInvestment": {
                "type": "number",
                "minimum": 0
              }
            }
          }
        }
      },
      "LightingCostResponse": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "apiVersion",
          "requestId",
          "operation",
          "inputs",
          "result",
          "warnings",
          "links"
        ],
        "properties": {
          "apiVersion": {
            "const": "1"
          },
          "requestId": {
            "type": "string"
          },
          "operation": {
            "const": "lighting-cost"
          },
          "inputs": {
            "$ref": "#/components/schemas/LightingCostRequest"
          },
          "result": {
            "type": "object"
          },
          "warnings": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "links": {
            "type": "object"
          }
        }
      }
    }
  }
}