{
  "$schema": "https://json-schema.org/draft-07/schema#",
  "type": "object",
  "required": ["server"],
  "properties": {
    "replicaCount": {
      "type": "integer",
      "minimum": 1,
      "description": "Number of Pulse server replicas"
    },
    "image": {
      "type": "object",
      "properties": {
        "repository": {
          "type": "string",
          "description": "Container image repository"
        },
        "pullPolicy": {
          "type": "string",
          "enum": ["Always", "IfNotPresent", "Never"],
          "description": "Image pull policy"
        },
        "tag": {
          "type": "string",
          "description": "Container image tag (overrides chart appVersion)"
        }
      }
    },
    "imagePullSecrets": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string"
          }
        }
      },
      "description": "Image pull secrets for private registries"
    },
    "service": {
      "type": "object",
      "properties": {
        "type": {
          "type": "string",
          "enum": ["ClusterIP", "NodePort", "LoadBalancer"],
          "description": "Kubernetes service type"
        },
        "port": {
          "type": "integer",
          "minimum": 1,
          "maximum": 65535,
          "description": "Service port"
        }
      }
    },
    "ingress": {
      "type": "object",
      "properties": {
        "enabled": {
          "type": "boolean",
          "description": "Enable ingress resource"
        },
        "className": {
          "type": "string",
          "description": "Ingress class name"
        },
        "hosts": {
          "type": "array",
          "items": {
            "type": "object",
            "properties": {
              "host": {
                "type": "string",
                "format": "hostname"
              },
              "paths": {
                "type": "array",
                "items": {
                  "type": "object",
                  "properties": {
                    "path": {
                      "type": "string"
                    },
                    "pathType": {
                      "type": "string",
                      "enum": ["Prefix", "Exact", "ImplementationSpecific"]
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "persistence": {
      "type": "object",
      "properties": {
        "enabled": {
          "type": "boolean",
          "description": "Enable persistent storage"
        },
        "existingClaim": {
          "type": "string",
          "description": "Use existing PVC"
        },
        "storageClass": {
          "type": "string",
          "description": "Storage class name"
        },
        "accessMode": {
          "type": "string",
          "enum": ["ReadWriteOnce", "ReadOnlyMany", "ReadWriteMany", "ReadWriteOncePod"],
          "description": "PVC access mode"
        },
        "size": {
          "type": "string",
          "pattern": "^[0-9]+[EPTGMK]i?$",
          "description": "Storage size (e.g., 8Gi)"
        }
      }
    },
    "server": {
      "type": "object",
      "properties": {
        "resources": {
          "type": "object",
          "description": "Resource requests and limits"
        },
        "env": {
          "type": "array",
          "description": "Environment variables"
        },
        "secretEnv": {
          "type": "object",
          "properties": {
            "create": {
              "type": "boolean"
            },
            "name": {
              "type": "string"
            },
            "data": {
              "type": "object"
            }
          }
        }
      }
    },
    "agent": {
      "type": "object",
      "properties": {
        "enabled": {
          "type": "boolean",
          "description": "Enable Docker monitoring agent"
        },
        "kind": {
          "type": "string",
          "enum": ["DaemonSet", "Deployment"],
          "description": "Agent deployment type"
        }
      }
    },
    "monitoring": {
      "type": "object",
      "properties": {
        "serviceMonitor": {
          "type": "object",
          "properties": {
            "enabled": {
              "type": "boolean",
              "description": "Create ServiceMonitor for Prometheus"
            },
            "interval": {
              "type": "string",
              "pattern": "^[0-9]+[smh]$",
              "description": "Scrape interval (e.g., 30s)"
            },
            "path": {
              "type": "string",
              "description": "Metrics endpoint path"
            }
          }
        }
      }
    }
  }
}
