> ## Documentation Index
> Fetch the complete documentation index at: https://docs.heychocolate.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Calculations

> Mutations for computing impact scores, MKI values, and equivalencies.

## calculateImpact

Calculate the environmental impact for a product with specific parameters.

```graphql theme={null}
mutation {
  calculateImpact(input: {
    productId: "prod_abc123"
    quantity: 100
    transportMethod: TRUCK
    distance: 500
    distanceUnit: KM
    originCountry: "NL"
    destinationCountry: "DE"
    locale: "en"
  }) {
    co2Equivalent
    mkiScore
    waterFootprint
    energyUse
    transportContribution
    breakdown {
      phase
      contribution
      percentage
    }
    equivalency {
      description
      value
      icon
    }
  }
}
```

**Input:**

| Field                | Type            | Required | Description                              |
| -------------------- | --------------- | -------- | ---------------------------------------- |
| `productId`          | ID!             | Yes      | Product identifier                       |
| `quantity`           | Int!            | Yes      | Number of units                          |
| `transportMethod`    | TransportMethod | No       | Transport type                           |
| `distance`           | Float           | No       | Transport distance                       |
| `distanceUnit`       | DistanceUnit    | No       | `KM` or `MILES`                          |
| `originCountry`      | String          | No       | ISO country code                         |
| `destinationCountry` | String          | No       | ISO country code                         |
| `locale`             | String          | No       | Locale for equivalencies (default: "en") |

## calculateMki

Calculate the MKI (Milieukostenindicator) score with lifecycle phases.

```graphql theme={null}
mutation {
  calculateMki(input: {
    productId: "prod_abc123"
    quantity: 1
    functionalUnit: "m2"
    lifespan: 75
    maintenanceScenario: STANDARD
  }) {
    mkiScore
    unit
    perFunctionalUnit
    breakdown {
      phase
      value
      percentage
    }
    phases {
      A1_A3 { value description }
      A4 { value description }
      A5 { value description }
      B1_B7 { value description }
      C1_C4 { value description }
      D { value description }
    }
  }
}
```

**Input:**

| Field                 | Type                | Required | Description                                 |
| --------------------- | ------------------- | -------- | ------------------------------------------- |
| `productId`           | ID!                 | Yes      | Product identifier                          |
| `quantity`            | Float               | No       | Quantity (default: 1)                       |
| `functionalUnit`      | String              | No       | Functional unit (e.g., "m2", "kg", "piece") |
| `lifespan`            | Int                 | No       | Product lifespan in years                   |
| `maintenanceScenario` | MaintenanceScenario | No       | `NONE`, `STANDARD`, `INTENSIVE`             |

## calculateCartImpact

Calculate the total impact of a shopping cart.

```graphql theme={null}
mutation {
  calculateCartImpact(input: {
    sessionId: "session_abc"
    items: [
      { productId: "prod_abc123", quantity: 2 },
      { productId: "prod_def456", quantity: 1 }
    ]
    shippingMethod: STANDARD
    shippingAddress: { country: "NL", postalCode: "1012AB" }
  }) {
    totalCo2Equivalent
    totalMkiScore
    shippingImpact
    perItemBreakdown {
      productName
      quantity
      co2Equivalent
      percentage
    }
    equivalency {
      description
      value
    }
  }
}
```

See the [ShoppingCart type](/api-reference/types/shopping-cart) for full details.

## recalculateProductImpact

Force a recalculation of a product's impact score (e.g., after EPD update).

```graphql theme={null}
mutation {
  recalculateProductImpact(productId: "prod_abc123") {
    co2Equivalent
    mkiScore
    previousScore {
      co2Equivalent
      mkiScore
    }
    delta {
      co2Equivalent
      percentageChange
    }
    calculatedAt
  }
}
```
