<!--
SPDX-FileCopyrightText: 2020-2023 Contributors to the Shapeshifter project

SPDX-License-Identifier: Apache-2.0
-->

# D-PrognosisResponse

Upon receiving and processing a prognosis message, the receiving implementation must reply with a D-PrognosisResponse, indicating whether the prognosis was syntactically and semantically valid, and, where any FlexOrder messages have previously been sent for any ISP in the period the prognosis applies to, a FlexOrderStatus indication for each of those orders.

```
<D-PrognosisResponse
  Metadata…
  ReferenceMessageID   = UUID
  Result               = ("Accepted" | "Rejected")
  RejectionReason      = String (Only if Result = "Rejected")
  <FlexOrderStatus       (0..n)
    Sequence           = Long
    IsValidated        = Boolean
  />
/>
```

|                    |                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               |
|--------------------| |
| Metadata           | The metadata for this message. For details, see [metadata attributes](metadata-attributes.md).                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                |
| ReferenceMessageID | Reference to the the D-prognosis that was accepted or rejected                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                |
| Result             | Indication whether the prognosis was accepted or rejected. A receiving implementation may reject a prognosis if it's syntactically invalid, uses a ISP duration or time zone that deviates from what is agreed upon for the market, is for a unknown Congestion Point or from an AGR that is not listed in the Common Reference, does not contain a full list of ISPs for the Period it applies to, contains implausible power values, applies to a Period for which all ISPs are already pending settlement, or if a Prognosis of the same type and from the same originator with a higher sequence number was already processed previously. |
| RejectionReason    | In case the update was rejected, this attribute must contain a human-readable description of the failure.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     |
| FlexOrderStatus    | Status of a previously submitted FlexOrder                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    |
| ⇥ Sequence         | Sequence of the previously submitted FlexOrder.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               |
| ⇥ IsValidated      | Indication whether the Prognosis that was just received reflects this previously submitted FlexOrder.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         |

