# Broad data-plane compatibility tests covering multiple Azure data-plane
# namespaces and resource shapes.  Each case exercises a distinct namespace
# to ensure the manifest-loading and data-plane normalization paths handle
# a variety of real-world patterns.

data_manifest_json: |
  {
    "dataNamespace": "Microsoft.Kubernetes.Data",
    "aliases": [],
    "resourceTypeAliases": [
      {
        "resourceType": "namespaces",
        "aliases": [
          {
            "name": "Microsoft.Kubernetes.Data/namespaces/labels",
            "paths": [{ "path": "labels", "apiVersions": ["v1"] }]
          },
          {
            "name": "Microsoft.Kubernetes.Data/namespaces/annotations",
            "paths": [{ "path": "annotations", "apiVersions": ["v1"] }]
          }
        ]
      },
      {
        "resourceType": "pods",
        "aliases": [
          {
            "name": "Microsoft.Kubernetes.Data/pods/containers[*].image",
            "paths": [{ "path": "containers[*].image", "apiVersions": ["v1"] }]
          },
          {
            "name": "Microsoft.Kubernetes.Data/pods/containers[*].name",
            "paths": [{ "path": "containers[*].name", "apiVersions": ["v1"] }]
          },
          {
            "name": "Microsoft.Kubernetes.Data/pods/containers[*].resources.limits.cpu",
            "paths": [{ "path": "containers[*].resources.limits.cpu", "apiVersions": ["v1"] }]
          },
          {
            "name": "Microsoft.Kubernetes.Data/pods/hostNetwork",
            "paths": [{ "path": "hostNetwork", "apiVersions": ["v1"] }]
          }
        ]
      }
    ]
  }

cases:
  # ── Kubernetes namespaces: flat labels/annotations ──
  - note: "k8s namespace with labels and annotations"
    use_registry_api: true
    input:
      type: "Microsoft.Kubernetes.Data/namespaces"
      labels:
        app: web-frontend
        version: "v2"
      annotations:
        owner: team-alpha
    expected_normalized:
      type: "Microsoft.Kubernetes.Data/namespaces"
      labels:
        app: web-frontend
        version: "v2"
      annotations:
        owner: team-alpha
    round_trip: true

  # ── Kubernetes pods: arrays with deeply nested fields ──
  - note: "k8s pod with containers array and resource limits"
    use_registry_api: true
    input:
      type: "Microsoft.Kubernetes.Data/pods"
      hostNetwork: false
      containers:
        - name: app
          image: "myregistry.azurecr.io/app:latest"
          resources:
            limits:
              cpu: "500m"
              memory: "256Mi"
        - name: sidecar
          image: "myregistry.azurecr.io/sidecar:v1"
          resources:
            limits:
              cpu: "100m"
    expected_normalized:
      type: "Microsoft.Kubernetes.Data/pods"
      hostnetwork: false
      containers:
        - name: app
          image: "myregistry.azurecr.io/app:latest"
          resources:
            limits:
              cpu: "500m"
              memory: "256Mi"
        - name: sidecar
          image: "myregistry.azurecr.io/sidecar:v1"
          resources:
            limits:
              cpu: "100m"
    round_trip: true

  - note: "k8s pod denormalize restores casing"
    use_registry_api: true
    input:
      type: "Microsoft.Kubernetes.Data/pods"
      hostnetwork: true
      containers:
        - name: app
          image: "nginx"
    expected_denormalized:
      type: "Microsoft.Kubernetes.Data/pods"
      hostNetwork: true
      containers:
        - name: app
          image: "nginx"
    reverse_round_trip: true

  # ── Unknown resource type in known namespace ──
  - note: "k8s unknown resource type passes through unchanged"
    use_registry_api: true
    input:
      type: "Microsoft.Kubernetes.Data/services"
      clusterIP: "10.0.0.1"
      ports:
        - port: 80
          targetPort: 8080
    expected_normalized:
      type: "Microsoft.Kubernetes.Data/services"
      clusterip: "10.0.0.1"
      ports:
        - port: 80
          targetport: 8080
    round_trip: true
    # No aliases for this type, so casing is lost on round-trip.
    expected_round_trip:
      type: "Microsoft.Kubernetes.Data/services"
      clusterip: "10.0.0.1"
      ports:
        - port: 80
          targetport: 8080

  # ── Empty containers array ──
  - note: "k8s pod with empty containers array"
    use_registry_api: true
    input:
      type: "Microsoft.Kubernetes.Data/pods"
      hostNetwork: false
      containers: []
    expected_normalized:
      type: "Microsoft.Kubernetes.Data/pods"
      hostnetwork: false
      containers: []
    round_trip: true
