# Example 3-node PlasmaCloud cluster topology
{ lib ? (import <nixpkgs> {}).lib }:

{
  nix-nos = {
    enable = true;

    clusters = {
      plasmacloud = {
        name = "plasmacloud-cluster";

        # Bootstrap node (first control-plane node by default)
        bootstrapNode = "node01";

        nodes = {
          # Control plane node 1 (bootstrap)
          node01 = {
            role = "control-plane";
            ip = "10.0.1.10";
            raftPort = 2380;
            apiPort = 2379;
            services = [
              "chainfire"
              "flaredb"
              "iam"
              "creditservice"
              "fiberlb"
              "flashdns"
            ];
            metadata = {
              datacenter = "dc1";
              rack = "rack1";
            };
          };

          # Control plane node 2
          node02 = {
            role = "control-plane";
            ip = "10.0.1.11";
            raftPort = 2380;
            apiPort = 2379;
            services = [
              "chainfire"
              "flaredb"
              "iam"
              "creditservice"
              "fiberlb"
              "flashdns"
            ];
            metadata = {
              datacenter = "dc1";
              rack = "rack2";
            };
          };

          # Control plane node 3
          node03 = {
            role = "control-plane";
            ip = "10.0.1.12";
            raftPort = 2380;
            apiPort = 2379;
            services = [
              "chainfire"
              "flaredb"
              "iam"
              "creditservice"
              "fiberlb"
              "flashdns"
            ];
            metadata = {
              datacenter = "dc1";
              rack = "rack3";
            };
          };

          # Worker node (optional - for workload separation)
          # node04 = {
          #   role = "worker";
          #   ip = "10.0.1.20";
          #   services = [
          #     "plasmavmc"
          #     "lightningstor"
          #     "k8shost"
          #   ];
          #   metadata = {
          #     datacenter = "dc1";
          #     rack = "rack1";
          #   };
          # };
        };
      };
    };
  };
}
