{
  "dashboard": {
    "title": "DBIS Core - Security & Compliance",
    "tags": ["security", "compliance", "audit"],
    "timezone": "browser",
    "schemaVersion": 27,
    "version": 1,
    "refresh": "30s",
    "panels": [
      {
        "id": 1,
        "title": "Authentication Failures",
        "type": "graph",
        "targets": [
          {
            "expr": "sum(rate(authentication_failures_total[5m])) by (reason)",
            "legendFormat": "{{reason}}"
          }
        ],
        "gridPos": {"h": 8, "w": 12, "x": 0, "y": 0}
      },
      {
        "id": 2,
        "title": "Authorization Failures",
        "type": "graph",
        "targets": [
          {
            "expr": "sum(rate(authorization_failures_total[5m])) by (resource, action)",
            "legendFormat": "{{resource}} - {{action}}"
          }
        ],
        "gridPos": {"h": 8, "w": 12, "x": 12, "y": 0}
      },
      {
        "id": 3,
        "title": "Sanctions Screening Results",
        "type": "graph",
        "targets": [
          {
            "expr": "sum(rate(sanctions_screening_total[5m])) by (result)",
            "legendFormat": "{{result}}"
          }
        ],
        "gridPos": {"h": 8, "w": 12, "x": 0, "y": 8}
      },
      {
        "id": 4,
        "title": "AML Risk Score Distribution",
        "type": "graph",
        "targets": [
          {
            "expr": "histogram_quantile(0.50, sum(rate(aml_risk_score_bucket[5m])) by (le))",
            "legendFormat": "P50"
          },
          {
            "expr": "histogram_quantile(0.95, sum(rate(aml_risk_score_bucket[5m])) by (le))",
            "legendFormat": "P95"
          },
          {
            "expr": "histogram_quantile(0.99, sum(rate(aml_risk_score_bucket[5m])) by (le))",
            "legendFormat": "P99"
          }
        ],
        "gridPos": {"h": 8, "w": 12, "x": 12, "y": 8}
      },
      {
        "id": 5,
        "title": "Audit Log Events",
        "type": "graph",
        "targets": [
          {
            "expr": "sum(rate(audit_log_events_total[5m])) by (event_type)",
            "legendFormat": "{{event_type}}"
          }
        ],
        "gridPos": {"h": 8, "w": 12, "x": 0, "y": 16}
      },
      {
        "id": 6,
        "title": "Policy Violations",
        "type": "graph",
        "targets": [
          {
            "expr": "sum(rate(policy_violations_total[5m])) by (policy_type, violation_type)",
            "legendFormat": "{{policy_type}} - {{violation_type}}"
          }
        ],
        "gridPos": {"h": 8, "w": 12, "x": 12, "y": 16}
      },
      {
        "id": 7,
        "title": "Failed Transactions by Reason",
        "type": "piechart",
        "targets": [
          {
            "expr": "sum(rate(transaction_failures_total[5m])) by (reason)",
            "legendFormat": "{{reason}}"
          }
        ],
        "gridPos": {"h": 8, "w": 12, "x": 0, "y": 24}
      },
      {
        "id": 8,
        "title": "Encryption Key Rotation Status",
        "type": "stat",
        "targets": [
          {
            "expr": "encryption_key_rotation_status",
            "legendFormat": "Status"
          }
        ],
        "fieldConfig": {
          "defaults": {
            "thresholds": {
              "mode": "absolute",
              "steps": [
                {"value": 0, "color": "red"},
                {"value": 1, "color": "green"}
              ]
            }
          }
        },
        "gridPos": {"h": 4, "w": 6, "x": 12, "y": 24}
      },
      {
        "id": 9,
        "title": "Data Access Events",
        "type": "graph",
        "targets": [
          {
            "expr": "sum(rate(data_access_events_total{data_type=\"PII\"}[5m])) by (operation)",
            "legendFormat": "PII - {{operation}}"
          },
          {
            "expr": "sum(rate(data_access_events_total{data_type=\"FINANCIAL\"}[5m])) by (operation)",
            "legendFormat": "Financial - {{operation}}"
          }
        ],
        "gridPos": {"h": 8, "w": 12, "x": 18, "y": 24}
      },
      {
        "id": 10,
        "title": "Security Incidents (24h)",
        "type": "stat",
        "targets": [
          {
            "expr": "increase(security_incidents_total[24h])",
            "legendFormat": "Incidents"
          }
        ],
        "gridPos": {"h": 4, "w": 6, "x": 0, "y": 32}
      },
      {
        "id": 11,
        "title": "Compliance Violations (24h)",
        "type": "stat",
        "targets": [
          {
            "expr": "increase(compliance_violations_total[24h])",
            "legendFormat": "Violations"
          }
        ],
        "gridPos": {"h": 4, "w": 6, "x": 6, "y": 32}
      }
    ]
  }
}
