<?xml version="1.0" encoding="UTF-8"?>
<definitions xmlns="https://www.omg.org/spec/DMN/20191111/MODEL/" id="Definitions_P05_RedemptionEligibility" name="P05 Voucher Redemption Eligibility" namespace="http://hotel-national-zermatt/dmn">
  <decision id="Decision_P05_RedemptionEligibility" name="Voucher redemption eligibility">
    <decisionTable id="DecisionTable_P05_RedemptionEligibility" hitPolicy="FIRST">
      <input id="Input_P05_Status" label="Voucher status">
        <inputExpression id="InputExpression_P05_Status" typeRef="string">
          <text>voucherStatus</text>
        </inputExpression>
      </input>
      <input id="Input_P05_Expired" label="Expired">
        <inputExpression id="InputExpression_P05_Expired" typeRef="boolean">
          <text>isExpired</text>
        </inputExpression>
      </input>
      <input id="Input_P05_Blackout" label="Blackout date">
        <inputExpression id="InputExpression_P05_Blackout" typeRef="boolean">
          <text>blackoutDate</text>
        </inputExpression>
      </input>
      <input id="Input_P05_ProductMatch" label="Product/rate match">
        <inputExpression id="InputExpression_P05_ProductMatch" typeRef="boolean">
          <text>productMatch</text>
        </inputExpression>
      </input>
      <output id="Output_P05_Decision" label="Decision" name="decision" typeRef="string" />
      <output id="Output_P05_Reason" label="Reason" name="reason" typeRef="string" />

      <rule id="Rule_P05_Allow">
        <inputEntry id="Rule_P05_Allow_Status"><text>"issued"</text></inputEntry>
        <inputEntry id="Rule_P05_Allow_Expired"><text>false</text></inputEntry>
        <inputEntry id="Rule_P05_Allow_Blackout"><text>false</text></inputEntry>
        <inputEntry id="Rule_P05_Allow_Match"><text>true</text></inputEntry>
        <outputEntry id="Rule_P05_Allow_Decision"><text>"allow"</text></outputEntry>
        <outputEntry id="Rule_P05_Allow_Reason"><text>"all redemption checks passed"</text></outputEntry>
      </rule>

      <rule id="Rule_P05_Deny_Status">
        <inputEntry id="Rule_P05_Deny_Status_Status"><text>not("issued")</text></inputEntry>
        <inputEntry id="Rule_P05_Deny_Status_Expired"><text>-</text></inputEntry>
        <inputEntry id="Rule_P05_Deny_Status_Blackout"><text>-</text></inputEntry>
        <inputEntry id="Rule_P05_Deny_Status_Match"><text>-</text></inputEntry>
        <outputEntry id="Rule_P05_Deny_Status_Decision"><text>"deny"</text></outputEntry>
        <outputEntry id="Rule_P05_Deny_Status_Reason"><text>"voucher not in issued status"</text></outputEntry>
      </rule>

      <rule id="Rule_P05_Deny_Expired">
        <inputEntry id="Rule_P05_Deny_Expired_Status"><text>"issued"</text></inputEntry>
        <inputEntry id="Rule_P05_Deny_Expired_Expired"><text>true</text></inputEntry>
        <inputEntry id="Rule_P05_Deny_Expired_Blackout"><text>-</text></inputEntry>
        <inputEntry id="Rule_P05_Deny_Expired_Match"><text>-</text></inputEntry>
        <outputEntry id="Rule_P05_Deny_Expired_Decision"><text>"deny"</text></outputEntry>
        <outputEntry id="Rule_P05_Deny_Expired_Reason"><text>"voucher expired"</text></outputEntry>
      </rule>

      <rule id="Rule_P05_Deny_BlackoutOrMismatch">
        <inputEntry id="Rule_P05_Deny_BlackoutOrMismatch_Status"><text>"issued"</text></inputEntry>
        <inputEntry id="Rule_P05_Deny_BlackoutOrMismatch_Expired"><text>false</text></inputEntry>
        <inputEntry id="Rule_P05_Deny_BlackoutOrMismatch_Blackout"><text>true</text></inputEntry>
        <inputEntry id="Rule_P05_Deny_BlackoutOrMismatch_Match"><text>-</text></inputEntry>
        <outputEntry id="Rule_P05_Deny_BlackoutOrMismatch_Decision"><text>"deny"</text></outputEntry>
        <outputEntry id="Rule_P05_Deny_BlackoutOrMismatch_Reason"><text>"requested stay falls in blackout period"</text></outputEntry>
      </rule>

      <rule id="Rule_P05_Deny_MismatchOnly">
        <inputEntry id="Rule_P05_Deny_MismatchOnly_Status"><text>"issued"</text></inputEntry>
        <inputEntry id="Rule_P05_Deny_MismatchOnly_Expired"><text>false</text></inputEntry>
        <inputEntry id="Rule_P05_Deny_MismatchOnly_Blackout"><text>false</text></inputEntry>
        <inputEntry id="Rule_P05_Deny_MismatchOnly_Match"><text>false</text></inputEntry>
        <outputEntry id="Rule_P05_Deny_MismatchOnly_Decision"><text>"deny"</text></outputEntry>
        <outputEntry id="Rule_P05_Deny_MismatchOnly_Reason"><text>"voucher product does not match booking"</text></outputEntry>
      </rule>
    </decisionTable>
  </decision>
</definitions>
