<mxfile host="app.diagrams.net">
  <diagram name="Estructura Servicio Master">
    <mxGraphModel dx="1400" dy="900" grid="1" gridSize="10" guides="1" tooltips="1" connect="1" arrows="1" fold="1" page="1" pageScale="1" pageWidth="1920" pageHeight="1080">
      <root>
        <mxCell id="0"/>
        <mxCell id="1" parent="0"/>

        <!-- API Layer -->
        <mxCell id="api" value="API Layer\n(Controllers REST)" style="swimlane;horizontal=0;startSize=28;fillColor=#E3F2FD;strokeColor=#1565C0;" vertex="1" parent="1">
          <mxGeometry x="80" y="60" width="360" height="180" as="geometry"/>
        </mxCell>

        <mxCell id="controllers" value="DashboardController\nShardController\nPlayerController\nEventController\nRankingController"
                style="rounded=1;fillColor=#BBDEFB;" vertex="1" parent="api">
          <mxGeometry x="30" y="50" width="300" height="100" as="geometry"/>
        </mxCell>

        <!-- Service Layer -->
        <mxCell id="service" value="Service Layer\n(Lógica de aplicación)" style="swimlane;horizontal=0;startSize=28;fillColor=#E8F5E9;strokeColor=#2E7D32;" vertex="1" parent="1">
          <mxGeometry x="80" y="270" width="360" height="220" as="geometry"/>
        </mxCell>

        <mxCell id="services" value="ShardDashboardService\nPlayerDashboardService\nRankingDashboardService\nEventDashboardService"
                style="rounded=1;fillColor=#C8E6C9;" vertex="1" parent="service">
          <mxGeometry x="30" y="50" width="300" height="140" as="geometry"/>
        </mxCell>

        <!-- Repository Layer -->
        <mxCell id="repo" value="Repository Layer\n(Spring Data)" style="swimlane;horizontal=0;startSize=28;fillColor=#FFF3E0;strokeColor=#EF6C00;" vertex="1" parent="1">
          <mxGeometry x="520" y="60" width="360" height="260" as="geometry"/>
        </mxCell>

        <mxCell id="repositories" value="ShardRepository\nPlayerRepository\nShardPlayerStatsRepository\nMasterEventRepository\nSnapshotRepository"
                style="rounded=1;fillColor=#FFE0B2;" vertex="1" parent="repo">
          <mxGeometry x="30" y="50" width="300" height="180" as="geometry"/>
        </mxCell>

        <!-- Domain Layer -->
        <mxCell id="domain" value="Domain Model\n(JPA Entities)" style="swimlane;horizontal=0;startSize=28;fillColor=#F3E5F5;strokeColor=#6A1B9A;" vertex="1" parent="1">
          <mxGeometry x="520" y="350" width="360" height="220" as="geometry"/>
        </mxCell>

        <mxCell id="entities" value="Shard\nPlayer\nShardPlayerStats\nMasterEvent\nShardWorldSnapshot"
                style="rounded=1;fillColor=#E1BEE7;" vertex="1" parent="domain">
          <mxGeometry x="30" y="50" width="300" height="140" as="geometry"/>
        </mxCell>

        <!-- DTOs -->
        <mxCell id="dto" value="DTOs / Projections" style="rounded=1;fillColor=#ECEFF1;strokeColor=#455A64;"
                vertex="1" parent="1">
          <mxGeometry x="80" y="520" width="360" height="100" as="geometry"/>
        </mxCell>

        <!-- Database -->
        <mxCell id="db" value="Master Database\n(PostgreSQL / MySQL)"
                style="shape=cylinder;fillColor=#E0F2F1;strokeColor=#00695C;"
                vertex="1" parent="1">
          <mxGeometry x="550" y="620" width="300" height="100" as="geometry"/>
        </mxCell>

        <!-- Edges -->
        <mxCell id="e1" style="endArrow=block;" edge="1" parent="1" source="api" target="service">
          <mxGeometry relative="1" as="geometry"/>
        </mxCell>

        <mxCell id="e2" style="endArrow=block;" edge="1" parent="1" source="service" target="repo">
          <mxGeometry relative="1" as="geometry"/>
        </mxCell>

        <mxCell id="e3" style="endArrow=block;" edge="1" parent="1" source="repo" target="domain">
          <mxGeometry relative="1" as="geometry"/>
        </mxCell>

        <mxCell id="e4" style="endArrow=block;" edge="1" parent="1" source="repo" target="db">
          <mxGeometry relative="1" as="geometry"/>
        </mxCell>

        <mxCell id="e5" style="dashed=1;endArrow=open;" edge="1" parent="1" source="service" target="dto">
          <mxGeometry relative="1" as="geometry"/>
        </mxCell>

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