<mxfile host="app.diagrams.net" agent="claude-code-byan" type="device">
  <diagram name="MCD - Commande" id="mcd-commande">
    <mxGraphModel dx="1400" dy="900" grid="1" gridSize="10" guides="1" tooltips="1" connect="1" arrows="1" fold="1" page="1" pageScale="1" pageWidth="1169" pageHeight="826" math="0" shadow="0">
      <root>
        <mxCell id="0" />
        <mxCell id="1" parent="0" />

        <mxCell id="commande" value="&lt;b&gt;COMMANDE&lt;/b&gt;&lt;hr&gt;id : INT (PK)&lt;br&gt;numero : VARCHAR (UNIQUE)&lt;br&gt;source : ENUM (kiosk|comptoir|drive)&lt;br&gt;mode_consommation : ENUM (sur_place|a_emporter|drive)&lt;br&gt;statut : ENUM&lt;br&gt;total_ht_cents : INT&lt;br&gt;total_tva_cents : INT&lt;br&gt;total_ttc_cents : INT&lt;br&gt;tva_taux_pourmille : SMALLINT&lt;br&gt;paye_a : DATETIME" style="rounded=0;whiteSpace=wrap;html=1;fillColor=#dae8fc;strokeColor=#6c8ebf;align=left;verticalAlign=top;fontSize=12;spacingLeft=8;spacingTop=4" vertex="1" parent="1">
          <mxGeometry x="440" y="40" width="320" height="240" as="geometry" />
        </mxCell>

        <mxCell id="user_stub" value="&lt;b&gt;USER&lt;/b&gt;&lt;hr&gt;id : INT (PK)&lt;br&gt;&lt;i&gt;(detail dans RBAC)&lt;/i&gt;" style="rounded=0;whiteSpace=wrap;html=1;fillColor=#e1d5e7;strokeColor=#9673a6;align=left;verticalAlign=top;fontSize=12;spacingLeft=8;spacingTop=4" vertex="1" parent="1">
          <mxGeometry x="880" y="40" width="240" height="80" as="geometry" />
        </mxCell>

        <mxCell id="commande_event" value="&lt;b&gt;COMMANDE_EVENT&lt;/b&gt;&lt;hr&gt;id : INT (PK)&lt;br&gt;commande_id : INT (FK)&lt;br&gt;event_type : ENUM&lt;br&gt;from_statut : ENUM (NULL)&lt;br&gt;to_statut : ENUM&lt;br&gt;user_id : INT (FK, NULL)&lt;br&gt;payload : JSON (NULL)&lt;br&gt;created_at : DATETIME" style="rounded=0;whiteSpace=wrap;html=1;fillColor=#d5e8d4;strokeColor=#82b366;align=left;verticalAlign=top;fontSize=12;spacingLeft=8;spacingTop=4" vertex="1" parent="1">
          <mxGeometry x="840" y="360" width="280" height="200" as="geometry" />
        </mxCell>

        <mxCell id="ligne_commande" value="&lt;b&gt;LIGNE_COMMANDE&lt;/b&gt;&lt;hr&gt;id : INT (PK)&lt;br&gt;commande_id : INT (FK)&lt;br&gt;type_item : ENUM (produit|menu)&lt;br&gt;produit_id : INT (FK, NULL)&lt;br&gt;menu_id : INT (FK, NULL)&lt;br&gt;libelle_snapshot : VARCHAR&lt;br&gt;prix_unitaire_ttc_cents_snapshot : INT&lt;br&gt;quantite : SMALLINT" style="rounded=0;whiteSpace=wrap;html=1;fillColor=#dae8fc;strokeColor=#6c8ebf;align=left;verticalAlign=top;fontSize=12;spacingLeft=8;spacingTop=4" vertex="1" parent="1">
          <mxGeometry x="440" y="360" width="280" height="220" as="geometry" />
        </mxCell>

        <mxCell id="produit" value="&lt;b&gt;PRODUIT&lt;/b&gt;&lt;hr&gt;id : INT (PK)&lt;br&gt;&lt;i&gt;(detail dans Catalogue)&lt;/i&gt;" style="rounded=0;whiteSpace=wrap;html=1;fillColor=#e1d5e7;strokeColor=#9673a6;align=left;verticalAlign=top;fontSize=12;spacingLeft=8;spacingTop=4" vertex="1" parent="1">
          <mxGeometry x="80" y="700" width="240" height="80" as="geometry" />
        </mxCell>

        <mxCell id="menu" value="&lt;b&gt;MENU&lt;/b&gt;&lt;hr&gt;id : INT (PK)&lt;br&gt;&lt;i&gt;(detail dans Catalogue)&lt;/i&gt;" style="rounded=0;whiteSpace=wrap;html=1;fillColor=#e1d5e7;strokeColor=#9673a6;align=left;verticalAlign=top;fontSize=12;spacingLeft=8;spacingTop=4" vertex="1" parent="1">
          <mxGeometry x="840" y="700" width="240" height="80" as="geometry" />
        </mxCell>

        <mxCell id="e_cmd_lc" value="contient" style="endArrow=none;html=1;fontSize=12;fontStyle=2;edgeStyle=orthogonalEdgeStyle;rounded=0" edge="1" parent="1" source="commande" target="ligne_commande">
          <mxGeometry relative="1" as="geometry" />
        </mxCell>
        <mxCell id="e_cmd_lc_a" value="(1,N)" style="edgeLabel;html=1;align=center;verticalAlign=middle;resizable=0;points=[];fontSize=11;fontStyle=1;fillColor=#ffffff;strokeColor=none" vertex="1" connectable="0" parent="e_cmd_lc">
          <mxGeometry x="-0.85" relative="1" as="geometry"><mxPoint as="offset" /></mxGeometry>
        </mxCell>
        <mxCell id="e_cmd_lc_b" value="(1,1)" style="edgeLabel;html=1;align=center;verticalAlign=middle;resizable=0;points=[];fontSize=11;fontStyle=1;fillColor=#ffffff;strokeColor=none" vertex="1" connectable="0" parent="e_cmd_lc">
          <mxGeometry x="0.85" relative="1" as="geometry"><mxPoint as="offset" /></mxGeometry>
        </mxCell>

        <mxCell id="e_lc_prod" value="refere_si_type_produit" style="endArrow=none;html=1;fontSize=12;fontStyle=2;edgeStyle=orthogonalEdgeStyle;rounded=0;dashed=1" edge="1" parent="1" source="ligne_commande" target="produit">
          <mxGeometry relative="1" as="geometry" />
        </mxCell>
        <mxCell id="e_lc_prod_a" value="(0,1)" style="edgeLabel;html=1;align=center;verticalAlign=middle;resizable=0;points=[];fontSize=11;fontStyle=1;fillColor=#ffffff;strokeColor=none" vertex="1" connectable="0" parent="e_lc_prod">
          <mxGeometry x="-0.85" relative="1" as="geometry"><mxPoint as="offset" /></mxGeometry>
        </mxCell>
        <mxCell id="e_lc_prod_b" value="(0,N)" style="edgeLabel;html=1;align=center;verticalAlign=middle;resizable=0;points=[];fontSize=11;fontStyle=1;fillColor=#ffffff;strokeColor=none" vertex="1" connectable="0" parent="e_lc_prod">
          <mxGeometry x="0.85" relative="1" as="geometry"><mxPoint as="offset" /></mxGeometry>
        </mxCell>

        <mxCell id="e_lc_menu" value="refere_si_type_menu" style="endArrow=none;html=1;fontSize=12;fontStyle=2;edgeStyle=orthogonalEdgeStyle;rounded=0;dashed=1" edge="1" parent="1" source="ligne_commande" target="menu">
          <mxGeometry relative="1" as="geometry" />
        </mxCell>
        <mxCell id="e_lc_menu_a" value="(0,1)" style="edgeLabel;html=1;align=center;verticalAlign=middle;resizable=0;points=[];fontSize=11;fontStyle=1;fillColor=#ffffff;strokeColor=none" vertex="1" connectable="0" parent="e_lc_menu">
          <mxGeometry x="-0.85" relative="1" as="geometry"><mxPoint as="offset" /></mxGeometry>
        </mxCell>
        <mxCell id="e_lc_menu_b" value="(0,N)" style="edgeLabel;html=1;align=center;verticalAlign=middle;resizable=0;points=[];fontSize=11;fontStyle=1;fillColor=#ffffff;strokeColor=none" vertex="1" connectable="0" parent="e_lc_menu">
          <mxGeometry x="0.85" relative="1" as="geometry"><mxPoint as="offset" /></mxGeometry>
        </mxCell>

        <mxCell id="note_poly" value="&lt;b&gt;Polymorphisme&lt;/b&gt;&lt;br&gt;Exactement UNE des deux references est non-nulle.&lt;br&gt;Discriminateur : type_item &amp;isin; {produit, menu}.&lt;br&gt;Contrainte CHECK SQL au MLD." style="rounded=1;whiteSpace=wrap;html=1;fillColor=#fff2cc;strokeColor=#d6b656;align=left;verticalAlign=top;fontSize=11;spacingLeft=8;spacingTop=4;dashed=1" vertex="1" parent="1">
          <mxGeometry x="80" y="360" width="280" height="100" as="geometry" />
        </mxCell>

        <mxCell id="e_cmd_evt" value="journalise" style="endArrow=none;html=1;fontSize=12;fontStyle=2;edgeStyle=orthogonalEdgeStyle;rounded=0" edge="1" parent="1" source="commande" target="commande_event">
          <mxGeometry relative="1" as="geometry" />
        </mxCell>
        <mxCell id="e_cmd_evt_a" value="(1,N)" style="edgeLabel;html=1;align=center;verticalAlign=middle;resizable=0;points=[];fontSize=11;fontStyle=1;fillColor=#ffffff;strokeColor=none" vertex="1" connectable="0" parent="e_cmd_evt">
          <mxGeometry x="-0.85" relative="1" as="geometry"><mxPoint as="offset" /></mxGeometry>
        </mxCell>
        <mxCell id="e_cmd_evt_b" value="(1,1)" style="edgeLabel;html=1;align=center;verticalAlign=middle;resizable=0;points=[];fontSize=11;fontStyle=1;fillColor=#ffffff;strokeColor=none" vertex="1" connectable="0" parent="e_cmd_evt">
          <mxGeometry x="0.85" relative="1" as="geometry"><mxPoint as="offset" /></mxGeometry>
        </mxCell>

        <mxCell id="e_user_evt" value="declenche" style="endArrow=none;html=1;fontSize=12;fontStyle=2;edgeStyle=orthogonalEdgeStyle;rounded=0;dashed=1" edge="1" parent="1" source="user_stub" target="commande_event">
          <mxGeometry relative="1" as="geometry" />
        </mxCell>
        <mxCell id="e_user_evt_a" value="(0,N)" style="edgeLabel;html=1;align=center;verticalAlign=middle;resizable=0;points=[];fontSize=11;fontStyle=1;fillColor=#ffffff;strokeColor=none" vertex="1" connectable="0" parent="e_user_evt">
          <mxGeometry x="-0.85" relative="1" as="geometry"><mxPoint as="offset" /></mxGeometry>
        </mxCell>
        <mxCell id="e_user_evt_b" value="(0,1)" style="edgeLabel;html=1;align=center;verticalAlign=middle;resizable=0;points=[];fontSize=11;fontStyle=1;fillColor=#ffffff;strokeColor=none" vertex="1" connectable="0" parent="e_user_evt">
          <mxGeometry x="0.85" relative="1" as="geometry"><mxPoint as="offset" /></mxGeometry>
        </mxCell>

        <mxCell id="note_audit" value="&lt;b&gt;Journal d'audit (event sourcing)&lt;/b&gt;&lt;br&gt;Append-only : aucun UPDATE / DELETE applicatif.&lt;br&gt;user_id NULL si auto-validation kiosk.&lt;br&gt;ON DELETE CASCADE cote commande_id.&lt;br&gt;ON DELETE SET NULL cote user_id." style="rounded=1;whiteSpace=wrap;html=1;fillColor=#fff2cc;strokeColor=#d6b656;align=left;verticalAlign=top;fontSize=11;spacingLeft=8;spacingTop=4;dashed=1" vertex="1" parent="1">
          <mxGeometry x="840" y="580" width="280" height="100" as="geometry" />
        </mxCell>

      </root>
    </mxGraphModel>
  </diagram>
</mxfile>
