import gql from 'graphql-tag'

import { client } from '@operato/graphql'

export async function evaluateEnergyConsumption(id: string) {
  var response = (
    await client.query({
      query: gql`
        query FetchevaluateEnergyConsumption($id: String!) {
          evaluateEnergyConsumption(id: $id) {
            stedNodes {
              name
              type
              params
              inlets {
                name
                type
                kind
                srcNode
                srcEdge
                data
              }
              outlets {
                name
                type
                kind
                dstNode
                dstEdge
                data
              }
            }
            stedDataMap
            smartGuides {
              name
              type
              guide
            }
          }
        }
      `,
      variables: { id }
    })
  ).data

  return response.evaluateEnergyConsumption
}
