# VM Lifecycle Defaults
#
# Default values for VM lifecycle configurations
# Migrated from provisioning/kcl/vm_lifecycle.k

let contracts = import "contracts.ncl" in

{
  default_persistence = {
    mode = 'permanent,
    auto_start = false,
    restart_policy = 'always,
    max_retries = 5,
    ttl_hours = 24,
    auto_cleanup = true,
    force_cleanup = false,
    cleanup_grace_period = 60,
    created_at_unix = 0,
  } | contracts.VmPersistence,

  default_lifecycle_policy = {
    on_host_reboot = 'start,
    on_host_shutdown = 'shutdown,
    on_memory_pressure = 'none,
    on_disk_full = 'none,
    enforce_memory_limit = true,
    enforce_cpu_limit = true,
    enforce_disk_limit = false,
  } | contracts.VmLifecyclePolicy,

  default_cleanup_policy = {
    cleanup_enabled = true,
    check_interval_minutes = 60,
    cleanup_window_start = "02:00",
    cleanup_window_end = "06:00",
    cleanup_in_window_only = true,
    max_concurrent_cleanups = 3,
    cleanup_batch_size = 10,
    require_confirmation = false,
    dry_run_mode = false,
    skip_on_low_resources = true,
    log_cleanup_operations = true,
    alert_on_cleanup_failure = true,
    retention_days = 7,
  } | contracts.VmCleanupPolicy,

  default_auto_start = {
    vm_name = "default",
    enabled = true,
    start_order = 0,
    start_delay_seconds = 0,
    wait_for_ssh = true,
    ssh_timeout_seconds = 300,
    on_start_failure = 'retry,
    max_start_retries = 3,
    depends_on = [],
  } | contracts.VmAutoStartConfig,

  # Template configurations
  permanent_vm_persistence = {
    mode = 'permanent,
    auto_start = true,
    restart_policy = 'always,
    max_retries = 5,
    created_at_unix = 0,
  } | contracts.VmPersistence,

  temporary_vm_persistence = {
    mode = 'temporary,
    ttl_hours = 24,
    auto_cleanup = true,
    force_cleanup = false,
    cleanup_grace_period = 60,
    created_at_unix = 0,
  } | contracts.VmPersistence,
}
