{
  "$schema": "http://json-schema.org/draft-07/schema#",
  "title": "SEQRED cloud-init generator config",
  "description": "Flat config object consumed by generateUserData()/generateMetaData()/generateNetworkConfig() (src/lib/cloud-init/generate.ts). Only format=\"cloud-init\" produces real output; kickstart/preseed are reserved for a future release. Paste a JSON object matching this schema into the tool's \"JSON\" panel to produce user-data/meta-data/network-config with zero manual clicking.",
  "type": "object",
  "additionalProperties": false,
  "properties": {
    "format": {
      "type": "string",
      "title": "Config format",
      "description": "Which output format is active. Only \"cloud-init\" produces real output today; kickstart and preseed are reserved for a future release.",
      "default": "cloud-init",
      "enum": ["cloud-init", "kickstart", "preseed"],
      "x-enumLabels": {
        "cloud-init": "Cloud-init (NoCloud) - working",
        "kickstart": "Kickstart (RHEL/Fedora) - coming soon",
        "preseed": "Debian Preseed - coming soon"
      },
      "x-step": "format"
    },
    "hostname": {
      "type": "string",
      "title": "Hostname",
      "description": "System hostname written to meta-data and used for /etc/hostname via cloud-init.",
      "default": "cloud-host",
      "x-step": "identity"
    },
    "locale": {
      "type": "string",
      "title": "Locale",
      "description": "glibc locale name, e.g. en_US.UTF-8.",
      "default": "en_US.UTF-8",
      "x-step": "identity"
    },
    "keyboardLayout": {
      "type": "string",
      "title": "Keyboard layout",
      "description": "XKB keyboard layout code, e.g. us, pl, de.",
      "default": "us",
      "x-step": "identity"
    },
    "timezone": {
      "type": "string",
      "title": "Timezone",
      "description": "IANA timezone name, e.g. Europe/Warsaw, UTC.",
      "default": "UTC",
      "x-step": "identity"
    },
    "userNames": {
      "type": "array",
      "title": "User names",
      "description": "Linux usernames to create, one per entry.",
      "default": ["ubuntu"],
      "items": {
        "type": "string"
      },
      "maxItems": 5,
      "x-step": "users"
    },
    "userSudoNopasswd": {
      "type": "array",
      "title": "Sudo without password (per user)",
      "description": "Parallel array to userNames: \"true\"/\"false\" - whether the user gets passwordless sudo via ALL=(ALL) NOPASSWD:ALL.",
      "default": ["true"],
      "items": {
        "type": "string"
      },
      "maxItems": 5,
      "x-step": "users"
    },
    "userSshKeys": {
      "type": "array",
      "title": "SSH public keys",
      "description": "One SSH public key line per user, parallel to userNames (empty string if none for that user). For multiple keys per user, separate with a comma inside the entry.",
      "default": [""],
      "items": {
        "type": "string"
      },
      "maxItems": 5,
      "x-step": "users"
    },
    "userPasswordHashes": {
      "type": "array",
      "title": "Password hashes (optional)",
      "description": "Parallel to userNames. A SHA-512 crypt hash (e.g. from `mkpasswd --method=SHA-512`) or empty for SSH-key-only login. Never a plaintext password. Stripped from exported/saved JSON config by default (opt-in to include).",
      "default": [""],
      "items": {
        "type": "string"
      },
      "maxItems": 5,
      "x-step": "users",
      "x-sensitive": true
    },
    "packageUpdate": {
      "type": "boolean",
      "title": "Update package index on first boot",
      "description": "Maps to the top-level cloud-config \"package_update\" key.",
      "default": true,
      "x-step": "packages"
    },
    "packageUpgrade": {
      "type": "boolean",
      "title": "Upgrade all packages on first boot",
      "description": "Maps to the top-level cloud-config \"package_upgrade\" key.",
      "default": false,
      "x-step": "packages"
    },
    "packagesCommon": {
      "type": "array",
      "title": "Common packages",
      "description": "Selected package names from the built-in checklist (curl, git, htop, vim, ufw, fail2ban, docker.io, unattended-upgrades, ...).",
      "default": [],
      "items": {
        "type": "string"
      },
      "x-step": "packages"
    },
    "packagesExtra": {
      "type": "array",
      "title": "Extra packages",
      "description": "Free-text additional package names, appended to packagesCommon.",
      "default": [],
      "items": {
        "type": "string"
      },
      "x-step": "packages"
    },
    "networkMode": {
      "type": "string",
      "title": "Network configuration mode",
      "description": "dhcp uses DHCP on the first interface; static configures a fixed IPv4 address/gateway/DNS.",
      "default": "dhcp",
      "enum": ["dhcp", "static"],
      "x-enumLabels": {
        "dhcp": "DHCP (automatic)",
        "static": "Static IP"
      },
      "x-step": "network"
    },
    "networkInterface": {
      "type": "string",
      "title": "Interface name",
      "description": "Network interface name/match, e.g. eth0, ens18.",
      "default": "eth0",
      "x-step": "network"
    },
    "networkAddress": {
      "type": "string",
      "title": "Static IP address (CIDR)",
      "description": "Used only when networkMode is \"static\", e.g. 192.168.1.50/24. Must include the prefix length (/24, /16, ...) - without it the address is malformed and the interface will not come up correctly.",
      "default": "",
      "x-step": "network",
      "x-dependsOn": {
        "field": "networkMode",
        "equals": "static"
      },
      "x-hiddenNote": "In DHCP mode the address is assigned automatically by your network - nothing to fill in here."
    },
    "networkGateway": {
      "type": "string",
      "title": "Gateway",
      "description": "Used only when networkMode is \"static\". The router IP the instance uses for traffic outside its subnet - get this wrong and the instance has an IP but no route to the internet/network.",
      "default": "",
      "x-step": "network",
      "x-dependsOn": {
        "field": "networkMode",
        "equals": "static"
      }
    },
    "networkDns": {
      "type": "array",
      "title": "DNS servers",
      "description": "Used only when networkMode is \"static\". One or more DNS server IPs - without at least one, the instance can reach IPs but cannot resolve hostnames.",
      "default": ["1.1.1.1", "9.9.9.9"],
      "items": {
        "type": "string"
      },
      "x-step": "network",
      "x-dependsOn": {
        "field": "networkMode",
        "equals": "static"
      }
    },
    "runcmd": {
      "type": "array",
      "title": "Run commands (runcmd)",
      "description": "Shell commands run once on first boot, in order, mapped to the cloud-config \"runcmd\" list.",
      "default": [],
      "items": {
        "type": "string"
      },
      "x-step": "runcmd"
    },
    "rebootPolicy": {
      "type": "string",
      "title": "Reboot policy",
      "description": "How the instance behaves once cloud-init finishes.",
      "default": "rebootIfNeeded",
      "enum": ["rebootIfNeeded", "alwaysReboot", "powerOff", "none"],
      "x-enumLabels": {
        "rebootIfNeeded": "Reboot only if required",
        "alwaysReboot": "Always reboot",
        "powerOff": "Power off when done",
        "none": "Do nothing"
      },
      "x-step": "final"
    }
  }
}
