use super::flow_models::{step, FlowStep, StepAction, StepDomain, StepFlags};

pub(super) fn guest_bootstrap_steps() -> Vec<FlowStep> {
    vec![
        step(
            "guest.choose-ip-mode",
            "Choose DHCP or static guest networking",
            StepDomain::Guest,
            StepAction::Choose,
            "Read-Host DHCP/static menu",
            "Caller-selected network mode",
            StepFlags::new(false, false),
        ),
        step(
            "guest.apply-static-network",
            "Apply static Alpine network config",
            StepDomain::Guest,
            StepAction::Configure,
            "/etc/network/interfaces and /etc/resolv.conf via SSH",
            "SSH script with structured success marker",
            StepFlags::new(false, true),
        ),
        step(
            "guest.wait-static-ssh",
            "Wait for SSH after network restart",
            StepDomain::Ssh,
            StepAction::Wait,
            "ssh true loop",
            "SSH executor wait_ready",
            StepFlags::new(false, true),
        ),
        step(
            "guest.detect-public-ip",
            "Detect public IP from VM",
            StepDomain::Guest,
            StepAction::Detect,
            "wget api.ipify.org",
            "detect_player_address_candidates via GuestProvider::detect_public_ip",
            StepFlags::new(false, true),
        ),
        step(
            "guest.select-player-ip",
            "Select player-facing IP",
            StepDomain::Guest,
            StepAction::Choose,
            "public/private/manual Read-Host menu",
            "Caller selects from PlayerAddressCandidates or supplies manual player-facing IP",
            StepFlags::new(false, false),
        ),
        step(
            "guest.write-settings-conf",
            "Write player-facing IP settings",
            StepDomain::Guest,
            StepAction::Configure,
            "printf '\\n\\n\\n$selectedIP\\n' > settings.conf",
            "SSH file write with exact settings format",
            StepFlags::new(false, false),
        ),
        step(
            "guest.upload-bootstrap",
            "Upload bootstrap setup helper",
            StepDomain::Ssh,
            StepAction::Upload,
            "base64 tee /home/dune/.dune/bin/setup",
            "SSH stdin upload and chmod",
            StepFlags::new(false, false),
        ),
        step(
            "guest.validate-disk",
            "Validate and grow root disk",
            StepDomain::Guest,
            StepAction::Configure,
            "bootstrap/setup validate_disk_space",
            "Guest disk provider using df/growpart/lvm/resize2fs",
            StepFlags::new(false, false),
        ),
        step(
            "guest.download-payload",
            "Download guest server payload",
            StepDomain::Steam,
            StepAction::Download,
            "steamcmd app_update 4754530",
            "Guest SteamCMD executor with retry policy",
            StepFlags::new(false, false),
        ),
        step(
            "guest.k3s.start",
            "Start k3s",
            StepDomain::Guest,
            StepAction::Start,
            "setup/k3s.sh rc-service k3s start",
            "OpenRC service provider start/wait",
            StepFlags::new(false, false),
        ),
        step(
            "guest.k3s.import-core-images",
            "Import k3s prerequisite images",
            StepDomain::Guest,
            StepAction::Import,
            "ctr images import prerequisites",
            "Container image import step with retry/restart policy",
            StepFlags::new(false, false),
        ),
        step(
            "guest.k3s.scale-core",
            "Scale core k3s deployments",
            StepDomain::Kubernetes,
            StepAction::Configure,
            "kubectl scale coredns/local-path/metrics/cert-manager",
            "Kubernetes client scale deployments",
            StepFlags::new(false, false),
        ),
        step(
            "guest.operators.update-crds",
            "Replace/apply operator CRDs",
            StepDomain::Kubernetes,
            StepAction::Configure,
            "kubectl replace/apply images/operators/crds",
            "Kubernetes apply server-side manifests",
            StepFlags::new(false, false),
        ),
        step(
            "guest.operators.patch-images",
            "Patch operator deployment images",
            StepDomain::Kubernetes,
            StepAction::Patch,
            "kubectl set image operators",
            "Kubernetes patch deployments",
            StepFlags::new(false, false),
        ),
        step(
            "guest.operators.scale",
            "Scale operator deployments",
            StepDomain::Kubernetes,
            StepAction::Configure,
            "kubectl scale funcom-operators",
            "Kubernetes client scale deployments",
            StepFlags::new(false, false),
        ),
        step(
            "guest.system.install-battlegroup-helper",
            "Install battlegroup helper symlink",
            StepDomain::Guest,
            StepAction::Configure,
            "setup/system.sh ln -s battlegroup.sh",
            "Guest filesystem symlink creation",
            StepFlags::new(false, false),
        ),
        step(
            "guest.world.read-region",
            "Choose world region",
            StepDomain::Interactive,
            StepAction::Choose,
            "world.sh Asia/Europe/North America/Oceania/South America",
            "Caller-selected region enum",
            StepFlags::new(false, false),
        ),
        step(
            "guest.world.read-name",
            "Choose world name",
            StepDomain::Interactive,
            StepAction::Choose,
            "world.sh world name prompt",
            "Caller-selected validated world name",
            StepFlags::new(false, false),
        ),
        step(
            "guest.world.read-token",
            "Read self-host token",
            StepDomain::Interactive,
            StepAction::Choose,
            "world.sh self-host token prompt",
            "Secret input never persisted",
            StepFlags::new(false, false),
        ),
        step(
            "guest.world.derive-host-id",
            "Derive HostId from token",
            StepDomain::Guest,
            StepAction::Configure,
            "Rust JWT payload decode HostId lowercase",
            "GuestBootstrapPlan::from_self_host_token extracts HostId with secret redaction",
            StepFlags::new(false, false),
        ),
        step(
            "guest.world.generate-name",
            "Generate world unique name",
            StepDomain::Guest,
            StepAction::Create,
            "sh-$HostId- six lowercase random letters",
            "GuestBootstrapPlan::from_self_host_token generates lowercase-only vendor suffix",
            StepFlags::new(false, false),
        ),
        step(
            "guest.world.render-manifests",
            "Render world and secret manifests",
            StepDomain::Files,
            StepAction::Configure,
            "sed substitutions on templates",
            "Structured template renderer preserving vendor YAML",
            StepFlags::new(false, false),
        ),
        step(
            "guest.world.wait-operators",
            "Wait for four operators ready",
            StepDomain::Kubernetes,
            StepAction::Wait,
            "kubectl deployment ready loop",
            "Kubernetes wait deployments",
            StepFlags::new(false, false),
        ),
        step(
            "guest.world.create-resources",
            "Create namespace, secrets, and BattleGroup",
            StepDomain::Kubernetes,
            StepAction::Create,
            "kubectl create ns/secret/battlegroup",
            "Kubernetes create resources",
            StepFlags::new(false, false),
        ),
        step(
            "guest.images.import-battlegroup",
            "Import battlegroup container images",
            StepDomain::Guest,
            StepAction::Import,
            "battlegroup.sh update-from-downloads image imports",
            "Container image import by manifest version",
            StepFlags::new(false, false),
        ),
        step(
            "guest.images.patch-battlegroup",
            "Patch BattleGroup image tags",
            StepDomain::Kubernetes,
            StepAction::Patch,
            "Rust JSON patch generation + kubectl patch",
            "Kubernetes JSON patch generated from live resource",
            StepFlags::new(false, false),
        ),
        step(
            "guest.defaults.wait-filebrowser",
            "Wait for filebrowser pod",
            StepDomain::Kubernetes,
            StepAction::Wait,
            "battlegroup.sh apply-default-usersettings",
            "Kubernetes pod wait by label",
            StepFlags::new(false, false),
        ),
        step(
            "guest.defaults.copy-user-settings",
            "Copy default UserSettings files",
            StepDomain::Kubernetes,
            StepAction::Configure,
            "kubectl cp UserEngine.ini/UserGame.ini",
            "Kubernetes copy/exec to mounted filebrowser data",
            StepFlags::new(false, false),
        ),
        step(
            "setup.complete",
            "Initial setup complete",
            StepDomain::Host,
            StepAction::Complete,
            "initial-setup.ps1 final message",
            "Flow result",
            StepFlags::new(false, false),
        ),
    ]
}
