digraph logic {
  graph [rankdir=TB, fontname="Helvetica", fontsize=13,
         label=<<B>Logic Diagram — samples/demo_emp_types</B>>, labelloc=t,
         pad=0.4, nodesep=0.90, ranksep=1.10, bgcolor="white",
         splines=spline]
  node  [fontname="Helvetica", fontsize=11, shape=plaintext]
  edge  [fontname="Helvetica", fontsize=10]

  // ── trigger ─────────────────────────────────────────────────────
  TRIGGER [label=<<TABLE BORDER="2" CELLBORDER="0" CELLPADDING="5" BGCOLOR="#e8f5e9" COLOR="#27ae60"><TR><TD><FONT COLOR="#27ae60"><B>&#9889; CommissionOrder inserted</B></FONT></TD></TR></TABLE>>, shape=plaintext]

  // ── schema layer ──────────────────────────────────────────────────
  CommissionOrder [label=<<TABLE BORDER="3" CELLBORDER="0" CELLSPACING="0" COLOR="#c0392b"><TR><TD COLSPAN="3" BGCOLOR="#4a6fa5"><FONT COLOR="white"><B> CommissionOrder </B></FONT></TD></TR><TR><TD PORT="CommissionOrder_amount_w" WIDTH="6" HEIGHT="18" BGCOLOR="#b8cce8"> </TD><TD PORT="CommissionOrder_amount" ALIGN="LEFT" BGCOLOR="#dbe4f0" CELLPADDING="3"><FONT COLOR="#1a1a2e"> amount </FONT></TD><TD PORT="CommissionOrder_amount_e" WIDTH="6" HEIGHT="18" BGCOLOR="#b8cce8"> </TD></TR></TABLE>>]
  Department [label=<<TABLE BORDER="3" CELLBORDER="0" CELLSPACING="0" COLOR="#c0392b"><TR><TD COLSPAN="3" BGCOLOR="#4a6fa5"><FONT COLOR="white"><B> Department </B></FONT></TD></TR><TR><TD PORT="Department_total_salary_w" WIDTH="6" HEIGHT="18" BGCOLOR="#b8cce8"> </TD><TD PORT="Department_total_salary" ALIGN="LEFT" BGCOLOR="#dbe4f0" CELLPADDING="3"><FONT COLOR="#1a1a2e"> total_salary </FONT></TD><TD PORT="Department_total_salary_e" WIDTH="6" HEIGHT="18" BGCOLOR="#b8cce8"> </TD></TR></TABLE>>]
  Employee [label=<<TABLE BORDER="3" CELLBORDER="0" CELLSPACING="0" COLOR="#c0392b"><TR><TD COLSPAN="3" BGCOLOR="#4a6fa5"><FONT COLOR="white"><B> Employee </B></FONT></TD></TR><TR><TD PORT="Employee_salary_w" WIDTH="6" HEIGHT="18" BGCOLOR="#b8cce8"> </TD><TD PORT="Employee_salary" ALIGN="LEFT" BGCOLOR="#dbe4f0" CELLPADDING="3"><FONT COLOR="#1a1a2e"> salary </FONT> <FONT COLOR="#e67e22" POINT-SIZE="9">= _employee_salary(row)</FONT></TD><TD PORT="Employee_salary_e" WIDTH="6" HEIGHT="18" BGCOLOR="#b8cce8"> </TD></TR><TR><TD PORT="Employee_type_w" WIDTH="6" HEIGHT="18" BGCOLOR="#b8cce8"> </TD><TD PORT="Employee_type" ALIGN="LEFT" BGCOLOR="#dbe4f0" CELLPADDING="3"><FONT COLOR="#1a1a2e"> type </FONT></TD><TD PORT="Employee_type_e" WIDTH="6" HEIGHT="18" BGCOLOR="#b8cce8"> </TD></TR><TR><TD PORT="Employee_union_w" WIDTH="6" HEIGHT="18" BGCOLOR="#b8cce8"> </TD><TD PORT="Employee_union" ALIGN="LEFT" BGCOLOR="#dbe4f0" CELLPADDING="3"><FONT COLOR="#1a1a2e"> union </FONT></TD><TD PORT="Employee_union_e" WIDTH="6" HEIGHT="18" BGCOLOR="#b8cce8"> </TD></TR><TR><TD PORT="Employee_max_hourly_weekly_salary_w" WIDTH="6" HEIGHT="18" BGCOLOR="#b8cce8"> </TD><TD PORT="Employee_max_hourly_weekly_salary" ALIGN="LEFT" BGCOLOR="#dbe4f0" CELLPADDING="3"><FONT COLOR="#1a1a2e"> max_hourly_weekly_salary </FONT></TD><TD PORT="Employee_max_hourly_weekly_salary_e" WIDTH="6" HEIGHT="18" BGCOLOR="#b8cce8"> </TD></TR><TR><TD PORT="Employee_total_compensation_w" WIDTH="6" HEIGHT="18" BGCOLOR="#b8cce8"> </TD><TD PORT="Employee_total_compensation" ALIGN="LEFT" BGCOLOR="#dbe4f0" CELLPADDING="3"><FONT COLOR="#1a1a2e"> total_compensation </FONT> <FONT COLOR="#e67e22" POINT-SIZE="9">= (salary or Decimal(0)) + De...</FONT></TD><TD PORT="Employee_total_compensation_e" WIDTH="6" HEIGHT="18" BGCOLOR="#b8cce8"> </TD></TR><TR><TD PORT="Employee_military_w" WIDTH="6" HEIGHT="18" BGCOLOR="#b8cce8"> </TD><TD PORT="Employee_military" ALIGN="LEFT" BGCOLOR="#dbe4f0" CELLPADDING="3"><FONT COLOR="#1a1a2e"> military </FONT></TD><TD PORT="Employee_military_e" WIDTH="6" HEIGHT="18" BGCOLOR="#b8cce8"> </TD></TR><TR><TD PORT="Employee_military_stipend_rate_per_year_w" WIDTH="6" HEIGHT="18" BGCOLOR="#b8cce8"> </TD><TD PORT="Employee_military_stipend_rate_per_year" ALIGN="LEFT" BGCOLOR="#dbe4f0" CELLPADDING="3"><FONT COLOR="#1a1a2e"> military_stipend_rate_per_year </FONT></TD><TD PORT="Employee_military_stipend_rate_per_year_e" WIDTH="6" HEIGHT="18" BGCOLOR="#b8cce8"> </TD></TR><TR><TD BGCOLOR="#c0392b"></TD><TD BGCOLOR="#fdf3e0" CELLPADDING="2"><FONT COLOR="#7a5c00" POINT-SIZE="9"><B> Type: hourly </B></FONT></TD><TD BGCOLOR="#c0392b"></TD></TR><TR><TD PORT="Employee_hours_worked_w" WIDTH="6" HEIGHT="18" BGCOLOR="#b8cce8"> </TD><TD PORT="Employee_hours_worked" ALIGN="LEFT" BGCOLOR="#fdf3e0" CELLPADDING="3"><FONT COLOR="#1a1a2e"> hours_worked </FONT></TD><TD PORT="Employee_hours_worked_e" WIDTH="6" HEIGHT="18" BGCOLOR="#b8cce8"> </TD></TR><TR><TD PORT="Employee_hourly_rate_w" WIDTH="6" HEIGHT="18" BGCOLOR="#b8cce8"> </TD><TD PORT="Employee_hourly_rate" ALIGN="LEFT" BGCOLOR="#fdf3e0" CELLPADDING="3"><FONT COLOR="#1a1a2e"> hourly_rate </FONT></TD><TD PORT="Employee_hourly_rate_e" WIDTH="6" HEIGHT="18" BGCOLOR="#b8cce8"> </TD></TR><TR><TD PORT="Employee_union_dues_w" WIDTH="6" HEIGHT="18" BGCOLOR="#b8cce8"> </TD><TD PORT="Employee_union_dues" ALIGN="LEFT" BGCOLOR="#fdf3e0" CELLPADDING="3"><FONT COLOR="#1a1a2e"> union_dues </FONT> <FONT COLOR="#e67e22" POINT-SIZE="9">= _union_dues(row)</FONT></TD><TD PORT="Employee_union_dues_e" WIDTH="6" HEIGHT="18" BGCOLOR="#b8cce8"> </TD></TR><TR><TD PORT="Employee_union_id_w" WIDTH="6" HEIGHT="18" BGCOLOR="#b8cce8"> </TD><TD PORT="Employee_union_id" ALIGN="LEFT" BGCOLOR="#fdf3e0" CELLPADDING="3"><FONT COLOR="#1a1a2e"> union_id </FONT></TD><TD PORT="Employee_union_id_e" WIDTH="6" HEIGHT="18" BGCOLOR="#b8cce8"> </TD></TR><TR><TD BGCOLOR="#c0392b"></TD><TD BGCOLOR="#e6f3ea" CELLPADDING="2"><FONT COLOR="#7a5c00" POINT-SIZE="9"><B> Type: commissioned </B></FONT></TD><TD BGCOLOR="#c0392b"></TD></TR><TR><TD PORT="Employee_commission_total_w" WIDTH="6" HEIGHT="18" BGCOLOR="#b8cce8"> </TD><TD PORT="Employee_commission_total" ALIGN="LEFT" BGCOLOR="#e6f3ea" CELLPADDING="3"><FONT COLOR="#1a1a2e"> commission_total </FONT></TD><TD PORT="Employee_commission_total_e" WIDTH="6" HEIGHT="18" BGCOLOR="#b8cce8"> </TD></TR><TR><TD PORT="Employee_base_salary_w" WIDTH="6" HEIGHT="18" BGCOLOR="#b8cce8"> </TD><TD PORT="Employee_base_salary" ALIGN="LEFT" BGCOLOR="#e6f3ea" CELLPADDING="3"><FONT COLOR="#1a1a2e"> base_salary </FONT></TD><TD PORT="Employee_base_salary_e" WIDTH="6" HEIGHT="18" BGCOLOR="#b8cce8"> </TD></TR><TR><TD BGCOLOR="#c0392b"></TD><TD BGCOLOR="#f0e6f5" CELLPADDING="2"><FONT COLOR="#7a5c00" POINT-SIZE="9"><B> military: yes </B></FONT></TD><TD BGCOLOR="#c0392b"></TD></TR><TR><TD PORT="Employee_military_stipend_w" WIDTH="6" HEIGHT="18" BGCOLOR="#b8cce8"> </TD><TD PORT="Employee_military_stipend" ALIGN="LEFT" BGCOLOR="#f0e6f5" CELLPADDING="3"><FONT COLOR="#1a1a2e"> military_stipend </FONT> <FONT COLOR="#e67e22" POINT-SIZE="9">= _military_stipend(row)</FONT></TD><TD PORT="Employee_military_stipend_e" WIDTH="6" HEIGHT="18" BGCOLOR="#b8cce8"> </TD></TR><TR><TD PORT="Employee_service_years_w" WIDTH="6" HEIGHT="18" BGCOLOR="#b8cce8"> </TD><TD PORT="Employee_service_years" ALIGN="LEFT" BGCOLOR="#f0e6f5" CELLPADDING="3"><FONT COLOR="#1a1a2e"> service_years </FONT></TD><TD PORT="Employee_service_years_e" WIDTH="6" HEIGHT="18" BGCOLOR="#b8cce8"> </TD></TR></TABLE>>]
  SysConfig [label=<<TABLE BORDER="1" CELLBORDER="0" CELLSPACING="0" COLOR="#4a6fa5"><TR><TD COLSPAN="3" BGCOLOR="#4a6fa5"><FONT COLOR="white"><B> SysConfig </B></FONT></TD></TR><TR><TD PORT="SysConfig_max_hourly_weekly_salary_w" WIDTH="6" HEIGHT="18" BGCOLOR="#b8cce8"> </TD><TD PORT="SysConfig_max_hourly_weekly_salary" ALIGN="LEFT" BGCOLOR="#dbe4f0" CELLPADDING="3"><FONT COLOR="#1a1a2e"> max_hourly_weekly_salary </FONT></TD><TD PORT="SysConfig_max_hourly_weekly_salary_e" WIDTH="6" HEIGHT="18" BGCOLOR="#b8cce8"> </TD></TR><TR><TD PORT="SysConfig_military_stipend_rate_per_year_w" WIDTH="6" HEIGHT="18" BGCOLOR="#b8cce8"> </TD><TD PORT="SysConfig_military_stipend_rate_per_year" ALIGN="LEFT" BGCOLOR="#dbe4f0" CELLPADDING="3"><FONT COLOR="#1a1a2e"> military_stipend_rate_per_year </FONT></TD><TD PORT="SysConfig_military_stipend_rate_per_year_e" WIDTH="6" HEIGHT="18" BGCOLOR="#b8cce8"> </TD></TR></TABLE>>]
  // ── rank groupings ────────────────────────────────────────────────
  { rank=min; Department; SysConfig }
  { rank=same; Employee }
  { rank=max; CommissionOrder; TRIGGER }

  // ── FK relationships ───────────────────────────────────────────
  CommissionOrder -> Employee [color="#e0e0e0", style=solid, arrowhead=none, arrowtail=crow, dir=both, penwidth=0.7, constraint=false, weight=1]
  Employee -> Department [color="#e0e0e0", style=solid, arrowhead=none, arrowtail=crow, dir=both, penwidth=0.7, constraint=false, weight=1]
  Employee -> SysConfig [color="#e0e0e0", style=solid, arrowhead=none, arrowtail=crow, dir=both, penwidth=0.7, constraint=false, weight=1]

  // ── trigger edge ──────────────────────────────────────────────
  TRIGGER -> CommissionOrder [color="#27ae60", style=bold, arrowhead=vee, penwidth=2, weight=10]

  // ── logic edges ────────────────────────────────────────────────────
  SysConfig:SysConfig_max_hourly_weekly_salary_w -> Employee:Employee_max_hourly_weekly_salary_w [label="1", color="#444444", fontcolor="#444444", arrowhead=vee, penwidth=1.8, weight=8]
  SysConfig:SysConfig_military_stipend_rate_per_year_w -> Employee:Employee_military_stipend_rate_per_year_w [label="2", color="#444444", fontcolor="#444444", arrowhead=vee, penwidth=1.8, weight=8]
  // INTRA:Employee:commission_total:salary:3:0
  // INTRA:Employee:base_salary:salary:3:1
  // INTRA:Employee:union:union_dues:4:2
  // INTRA:Employee:salary:total_compensation:5:3
  // INTRA:Employee:military_stipend_rate_per_year:military_stipend:6:4
  CommissionOrder:CommissionOrder_amount_w -> Employee:Employee_commission_total_w [label="7", color="#444444", fontcolor="#444444", arrowhead=vee, penwidth=2, style=dashed, weight=8]
  Employee:Employee_salary_w -> Department:Department_total_salary_w [label="8", color="#444444", fontcolor="#444444", arrowhead=vee, penwidth=2, style=dashed, weight=8]
}