{
  "swagger": "2.0",
  "info": {
    "description": "Provides functionality to get WLTP information for one or more derivative.",
    "version": "0.0.0",
    "title": "WLTP Service",
    "contact": {
      "email": "dev@cap-hpi.com"
    }
  },
  "host": "api.cap-hpi.co.uk",
  "basePath": "/v1",
  "paths": {
    "/wltp": {
      "post": {
        "summary": "Gets the WLTP for one or more derivatives",
        "tags": [
          "Get WLTP"
        ],
        "operationId": "getDerivativesWltp",
        "consumes": [
          "application/json"
        ],
        "produces": [
          "application/json"
        ],
        "parameters": [
          {
            "name": "request",
            "in": "body",
            "description": "The derivative details of one or more derivatives to obtain the WLTP",
            "schema": {
              "$ref": "#/definitions/DerivativeConfigurationCollection"
            },
            "required": true
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "schema": {
              "type": "array",
              "items": {
                "$ref": "#/definitions/DerivativeResponse"
              }
            }
          },
          "206": {
            "description": "Partial Response"
          },
          "400": {
            "description": "Bad Request"
          },
          "404": {
            "description": "Not Found"
          }
        }
      }
    }
  },
  "definitions": {
    "DerivativeConfigurationCollection": {
      "type": "array",
      "items": {
        "$ref": "#/definitions/DerivativeConfiguration"
      }
    },
    "DerivativeType": {
      "type": "string",
      "enum": [
        "Car",
        "LCV"
      ]
    },
    "DerivativeConfiguration": {
      "required": [
        "capId",
        "derivativeType",
        "modelYear",
        "configurationDate"
      ],
      "type": "object",
      "properties": {
        "id": {
          "description": "Request identifier that can be set (if supplied by the requester)",
          "type": "string"
        },
        "configurationDate": {
          "description": "Date of configuration",
          "type": "string",
          "format": "date"
        },
        "derivativeType": {
          "$ref": "#/definitions/DerivativeType"
        },
        "capId": {
          "format": "int32",
          "type": "integer"
        },
        "modelYear": {
          "type": "string"
        },
        "selectedEquipmentIds": {
          "type": "array",
          "items": {
            "format": "int32",
            "type": "integer"
          }
        }
      }
    },
    "BusinessError": {
      "type": "object",
      "properties": {
        "id": {
          "type": "integer",
          "description": "id used by customer to lookup error details in dictionary"
        },
        "type": {
          "type": "string",
          "description": "short name"
        },
        "message": {
          "type": "string",
          "description": "detailed description "
        }
      }
    },
    "TechnicalSpecificationItem": {
      "type": "object",
      "properties": {
        "id": {
          "description": "The ID of this technical item",
          "type": "integer"
        },
        "name": {
          "description": "The human-readable name of this technical item",
          "type": "string"
        },
        "value": {
          "description": "The value of this technical item",
          "type": "number"
        }
      }
    },
    "DerivativeResponseItem": {
      "type": "object",
      "properties": {
        "id": {
          "type": "string",
          "format": "string"
        },
        "configurationDate": {
          "description": "Date of configuration",
          "type": "string",
          "format": "date"
        },
        "validUntil": {
          "description": "The date until which these values are valid",
          "type": "string",
          "format": "date",
          "example": "2017-06-30"
        },
        "examinationDate": {
          "type": "string",
          "format": "date",
          "example": "2017-05-31"
        },
        "derivativeType": {
          "$ref": "#/definitions/DerivativeType"
        },
        "capId": {
          "type": "integer",
          "format": "int32"
        },
        "modelYear": {
          "type": "string",
          "example": "2017.25"
        },
        "selectedEquipmentIds": {
          "type": "array",
          "items": {
            "format": "int32",
            "type": "integer"
          }
        },
        "errors": {
          "description": "Array of error codes",
          "type": "array",
          "items": {
            "$ref": "#/definitions/BusinessError"
          }
        },
        "technicalSpecificationItems": {
          "description": "Array of calculated items",
          "type": "array",
          "items": {
            "$ref": "#/definitions/TechnicalSpecificationItem"
          }
        }
      }
    },
    "DerivativeResponse": {
      "type": "object",
      "properties": {
        "auditId": {
          "type": "string",
          "format": "guid"
        },
        "errors": {
          "description": "Array of global error codes",
          "type": "array",
          "items": {
            "$ref": "#/definitions/BusinessError"
          }
        },
        "wltpData": {
          "description": "Array of response items",
          "type": "array",
          "items": {
            "$ref": "#/definitions/DerivativeResponseItem"
          }
        }
      }
    }
  }
}