{
  "version": "1.0",
  "name": "Hyperledger Besu Network",
  "description": "Deploys a Hyperledger Besu blockchain network",
  "parameters": [
    {
      "name": "networkName",
      "type": "string",
      "description": "Name of the blockchain network",
      "required": true
    },
    {
      "name": "validatorCount",
      "type": "number",
      "description": "Number of validator nodes",
      "default": 3,
      "validation": {
        "min": 1,
        "max": 10
      }
    },
    {
      "name": "consensus",
      "type": "string",
      "description": "Consensus algorithm",
      "default": "IBFT2",
      "validation": {
        "enum": ["IBFT2", "QBFT", "Clique"]
      }
    }
  ],
  "resources": [
    {
      "type": "kubernetes_namespace",
      "name": "besu_namespace",
      "properties": {
        "name": "${networkName}"
      }
    },
    {
      "type": "kubernetes_deployment",
      "name": "besu_validator",
      "dependsOn": ["kubernetes_namespace.besu_namespace"],
      "properties": {
        "name": "besu-validator",
        "namespace": "${networkName}",
        "replicas": "${validatorCount}",
        "image": "hyperledger/besu:latest",
        "ports": [
          {
            "containerPort": 8545,
            "name": "rpc"
          },
          {
            "containerPort": 8546,
            "name": "ws"
          }
        ]
      }
    }
  ],
  "outputs": [
    {
      "name": "rpc_endpoint",
      "description": "RPC endpoint URL",
      "value": "http://besu-validator.${networkName}.svc.cluster.local:8545"
    }
  ]
}

