<?xml version="1.0" encoding="UTF-8"?>
<!-- A-0310: loan_risk.dmn
     Decision table: creditScore → riskLevel
       < 600        → HIGH
       600–750      → MEDIUM
       > 750        → LOW
-->
<definitions
  xmlns="https://www.omg.org/spec/DMN/20191111/MODEL/"
  xmlns:dmndi="https://www.omg.org/spec/DMN/20191111/DMNDI/"
  xmlns:dc="http://www.omg.org/spec/DMN/20180521/DC/"
  id="def_loan_risk"
  name="Loan Risk"
  namespace="http://priostack.com/tutorial">

  <decision id="loan_risk" name="Loan Risk Assessment">
    <decisionTable id="dt_loan_risk" hitPolicy="FIRST">

      <input id="in_credit_score" label="Credit Score">
        <inputExpression id="ie_credit_score" typeRef="integer">
          <text>creditScore</text>
        </inputExpression>
      </input>

      <output id="out_risk_level" label="Risk Level" name="riskLevel" typeRef="string"/>

      <!-- Rule 1: creditScore < 600 → HIGH -->
      <rule id="rule_high">
        <inputEntry id="ie_high"><text>&lt; 600</text></inputEntry>
        <outputEntry id="oe_high"><text>"HIGH"</text></outputEntry>
        <annotationEntry><text>Low credit score — high risk</text></annotationEntry>
      </rule>

      <!-- Rule 2: creditScore 600–750 → MEDIUM -->
      <rule id="rule_medium">
        <inputEntry id="ie_medium"><text>[600..750]</text></inputEntry>
        <outputEntry id="oe_medium"><text>"MEDIUM"</text></outputEntry>
        <annotationEntry><text>Average credit score — medium risk</text></annotationEntry>
      </rule>

      <!-- Rule 3: creditScore > 750 → LOW -->
      <rule id="rule_low">
        <inputEntry id="ie_low"><text>&gt; 750</text></inputEntry>
        <outputEntry id="oe_low"><text>"LOW"</text></outputEntry>
        <annotationEntry><text>High credit score — low risk</text></annotationEntry>
      </rule>

    </decisionTable>
  </decision>

  <dmndi:DMNDI>
    <dmndi:DMNDiagram>
      <dmndi:DMNShape dmnElementRef="loan_risk">
        <dc:Bounds x="157" y="81" width="180" height="80"/>
      </dmndi:DMNShape>
    </dmndi:DMNDiagram>
  </dmndi:DMNDI>

</definitions>
