{
  "openapi": "3.0.0",
  "info": {
    "title": "eviShine API",
    "description": "eviShine API",
    "version": "0.0.1"
  },
  "paths": {
    "/owner/": {
      "get": {
        "description": "Returns the owner associated to user or api-key.",
        "responses": {
          "200": {
            "description": "An owner object.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/owner"
                }
              }
            }
          }
        }
      }
    },
    "/owner/sites/": {
      "post": {

      },
      "get": {
        "description": "Returns list of the sites associated with the owner.",
        "responses": {
          "200": {
            "description": "A list of sites.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/site"
                  }
                }
              }
            }
          }
        }
      }
    },
    "/owner/sites/{nodeId}/": {
      "delete": {

      },
      "get": {
        "description": "Returns site with given nodeId.",
        "parameters": [
          {
            "name": "node-id",
            "in": "path",
            "description": "NodeId of the site.",
            "required": true,
            "schema": {
              "type": "integer",
              "format": "int64"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "A site object.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/site"
                }
              }
            }
          }
        }
      },
      "patch": {

      }
    },
    "/owner/sites/{nodeId}/followup/": {
      "patch": {

      }
    },
    "/owner/sites/{nodeId}/settings/": {
      "patch": {

      }
    },
    "/owner/devices/": {
      "post": {

      },
      "get": {
        "description": "Returns all devices associated with the owner or all devices associated with a site specified in a query parameter.",
        "parameters": [
          {
            "name": "site-node-id",
            "in": "query",
            "description": "NodeId of the site.",
            "schema": {
              "type": "integer",
              "format": "int64"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "A list of devices.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/device"
                  }
                }
              }
            }
          }
        }
      }
    },
    "/owner/devices/{nodeId}/": {
      "delete": {

      },
      "get": {
        "description": "Returns device with given nodeId.",
        "parameters": [
          {
            "name": "nodeId",
            "in": "path",
            "description": "NodeId of the device.",
            "required": true,
            "schema": {
              "type": "integer",
              "format": "int64"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "A device object.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/device"
                }
              }
            }
          }
        }
      },
      "patch": {

      }
    },
    "/owner/devices/{nodeId}/alarms/": {
      "patch": {

      }

    },
    "/owner/devices/{nodeId}/followup/": {
      "patch": {

      }
    },
    "/owner/devices/{nodeId}/measure-points/": {
      "patch": {

      }

    },
    "/owner/devices/{nodeId}/metadata/": {
      "patch": {

      }
    },
    "/owner/devices/{nodeId}/rsi/": {
      "patch": {

      }
    },
    "/owner/devices/{nodeId}/serial-connection/": {
      "patch": {

      }
    },
    "/owner/devices/{nodeId}/settings/": {
      "patch": {

      }
    },
    "/user/": {
      "get": {
        "description": "Returns user info if api is used with login.",
        "responses": {
          "200": {
            "description": "A user object.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/user"
                }
              }
            }
          }
        }
      }
    },
    "/user/access/": {
      "get": {
        "description": "Returns access info of the user if api is used with login.",
        "responses": {
          "200": {
            "description": "A list of user access objects.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/userAccess"
                  }
                }
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "apiKey": {
        "type": "object",
        "properties": {
          "key": {
            "type": "string"
          },
          "name": {
            "type": "string"
          },
          "serviceName": {
            "type": "string"
          },
          "nodeId": {
            "type": "integer",
            "format": "int64"
          },
          "nodeArea": {
            "type": "string",
            "example": "documents"
          },
          "nodeGrantSubLevels": {
            "type": "boolean"
          },
          "nodeGrantLevel": {
            "type": "string"
          }
        }
      },
      "device": {
        "type": "object",
        "properties": {
          "general": {
            "type": "object",
            "properties": {
              "nodeId": {
                "type": "integer",
                "format": "int64"
              },
              "name": {
                "type": "string"
              },
              "ownerNodeId": {
                "type": "integer",
                "format": "int64"
              },
              "ownerName": {
                "type": "string"
              },
              "siteNodeId": {
                "type": "integer",
                "format": "int64"
              },
              "siteName": {
                "type": "string"
              },
              "deviceClassification": {
                "type": "string"
              },
              "operationLevel": {
                "type": "string"
              },
              "isolated": {
                "type": "boolean"
              }
            }
          },
          "alarms": {
            "type": "object",
            "properties": {
              "supressAlarmsUntil": {
                "type": "string",
                "format": "date-time"
              }
            }
          },
          "followup": {
            "type": "object",
            "properties": {
              "followupDate": {
                "type": "string",
                "format": "date-time"
              },
              "comment": {
                "type": "string"
              },
              "priority": {
                "type": "integer",
                "format": "int32"
              }
            }
          },
          "measurePoints": {
            "type": "object",
            "properties": {
              "deviceType": {
                "type": "string"
              },
              "deviceTypeName": {
                "type": "string"
              }
            }
          },
          "metadata": {
            "type": "object",
            "properties": {
              "model": {
                "type": "string"
              },
              "producer": {
                "type": "string"
              },
              "productClassification": {
                "type": "string"
              },
              "productSubClassification": {
                "type": "string"
              },
              "nominalValue": {
                "type": "string"
              },
              "softwareVersion": {
                "type": "string"
              },
              "productNumber": {
                "type": "string"
              },
              "serialNumber": {
                "type": "string"
              }
            }
          },
          "rsi": {
            "type": "object",
            "properties": {
              "relativeStrengthIndex": {
                "type": "integer",
                "format": "int32"
              },
              "relativeStrengthIndexGroup": {
                "type": "string"
              },
              "relativeStrengthThreshold": {
                "type": "integer",
                "format": "int32"
              }
            }
          },
          "serialConnection": {
            "type": "object",
            "properties": {
              "converterNodeId": {
                "type": "integer",
                "format": "int64"
              },
              "networkId": {
                "type": "string"
              },
              "lastAliveDate": {
                "type": "string",
                "format": "date-time"
              }
            }
          },
          "settings": {
            "type": "object",
            "properties": {
              "publicReadAccess": {
                "type": "boolean"
              },
              "hidden": {
                "type": "boolean"
              }
            }
          }
        }
      },
      "owner": {
        "type": "object",
        "properties": {
          "general": {
            "type": "object",
            "properties": {
              "name": {
                "type": "string"
              },
              "nodeId": {
                "type": "integer",
                "format": "int64"
              }
            }
          },
          "contact": {
            "type": "object",
            "properties": {
              "recipient": {
                "type": "string"
              },
              "coRecipient": {
                "type": "string"
              },
              "phoneNumber": {
                "type": "string"
              },
              "email": {
                "type": "string"
              },
              "address": {
                "type": "object",
                "properties": {
                  "street": {
                    "type": "string"
                  },
                  "streetNumber": {
                    "type": "string"
                  },
                  "postalCode": {
                    "type": "string"
                  },
                  "countryCode": {
                    "type": "string"
                  },
                  "municipalityCode": {
                    "type": "string"
                  },
                  "city": {
                    "type": "string"
                  },
                  "locality": {
                    "type": "string"
                  },
                  "municipality": {
                    "type": "string"
                  }
                }
              }
            }
          },
          "settings": {
            "type:": "object",
            "properties": {
              "publicReadAccess": {
                "type": "boolean"
              },
              "publicReadAccessMeters": {
                "type": "boolean"
              },
              "co2Factor": {
                "type": "number",
                "format": "double"
              }
            }
          },
          "licence": {
            "type": "object",
            "properties": {
              "licenceName": {
                "type": "string"
              },
              "customerNumber": {
                "type": "string"
              },
              "subscriptionDueDate": {
                "type": "string",
                "format": "date"
              },
              "subscriptionMessage": {
                "type": "string"
              }
            }
          },
          "followup": {
            "type": "object",
            "properties": {
              "followupDate": {
                "type": "string",
                "format": "date-time"
              },
              "comment": {
                "type": "string"
              }
            }
          }
        }
      },
      "site": {
        "type": "object",
        "properties": {
          "general": {
            "type": "object",
            "properties": {
              "name": {
                "type": "string"
              },
              "nodeId": {
                "type": "integer",
                "format": "int64"
              },
              "ownerNodeId": {
                "type": "integer",
                "format": "int64"
              },
              "ownerName": {
                "type": "string"
              },
              "parentSiteNodeId": {
                "type": "integer",
                "format": "int64"
              },
              "gpsCoordinate": {
                "type": "string"
              },
              "gpsCoordinateLocked": {
                "type": "boolean"
              },
              "timeZone": {
                "type": "string"
              },
              "address": {
                "type": "object",
                "properties": {
                  "street": {
                    "type": "string"
                  },
                  "streetNumber": {
                    "type": "string"
                  },
                  "postalCode": {
                    "type": "string"
                  },
                  "countryCode": {
                    "type": "string"
                  },
                  "municipalityCode": {
                    "type": "string"
                  },
                  "city": {
                    "type": "string"
                  },
                  "locality": {
                    "type": "string"
                  },
                  "municipality": {
                    "type": "string"
                  }
                }
              }
            }
          },
          "settings": {
            "type": "object",
            "properties": {
              "suppressAlarmsUntil": {
                "type": "string",
                "format": "date-time"
              },
              "solarPanelProducer": {
                "type": "string"
              },
              "inverterProducer": {
                "type": "string"
              },
              "publicReadAccess": {
                "type": "boolean"
              }
            }
          },
          "followup": {
            "type": "object",
            "properties": {
              "followupDate": {
                "type": "string",
                "format": "date-time"
              },
              "comment": {
                "type": "string"
              }
            }
          }
        }
      },
      "user": {
        "type": "object",
        "properties": {
          "general": {
            "type": "object",
            "properties": {
              "username": {
                "type": "string"
              },
              "password": {
                "type": "string"
              },
              "sysAdmin": {
                "type": "boolean"
              },
              "latestLoginDate": {
                "type": "string",
                "format": "date"
              }
            }
          },
          "user": {
            "type": "object",
            "properties": {
              "firstName": {
                "type": "string"
              },
              "lastName": {
                "type": "string"
              },
              "street": {
                "type": "string"
              },
              "streetNumber": {
                "type": "string"
              },
              "postalCode": {
                "type": "string"
              },
              "city": {
                "type": "string"
              },
              "countryCode": {
                "type": "string"
              },
              "phone": {
                "type": "string"
              },
              "email": {
                "type": "string"
              }
            }
          }
        }
      },
      "userAccess": {
        "type": "object",
        "properties": {
          "ownerNodeId": {
            "type": "integer",
            "format": "int64"
          },
          "partnerNodeId": {
            "type": "integer",
            "format": "int64"
          },
          "siteNodeId": {
            "type": "integer",
            "format": "int64"
          },
          "role": {
            "type": "string"
          }
        }
      }
    }
  }
}