# Installer Storage Configuration Fragment

[[elements]]
border_bottom = false
border_top = true
name = "installer_storage_section_header"
title = "💾 Storage Configuration"
type = "section_header"

# Storage Location
[[elements]]
default = "/var/lib/provisioning"
help = "Root directory for provisioning data storage"
name = "storage_root_path"
nickel_path = ["installer", "storage", "root_path"]
prompt = "Storage Root Path"
required = true
type = "text"

[[elements]]
default = 500
help = "Allocated storage space in GB (range: 10-100000)"
max = 100000
min = 10
name = "storage_size_gb"
nickel_path = ["installer", "storage", "size_gb"]
prompt = "Storage Size (GB)"
type = "number"

# Storage Backend Selection
[[elements]]
default = "filesystem"
help = "Storage backend type"
name = "installer_storage_backend"
nickel_path = ["installer", "storage", "backend"]
options = ["filesystem", "object_storage", "block_storage"]
prompt = "Storage Backend"
type = "select"

# Filesystem Storage (conditional)
[[elements]]
condition = "installer_storage_backend == 'filesystem'"
default = "ext4"
help = "File system type"
name = "filesystem_type"
nickel_path = ["installer", "storage", "filesystem", "type"]
options = ["ext4", "xfs", "btrfs", "zfs"]
prompt = "File System Type"
type = "select"

[[elements]]
condition = "installer_storage_backend == 'filesystem'"
default = true
help = "Enable file system snapshots"
name = "filesystem_snapshots_enabled"
nickel_path = ["installer", "storage", "filesystem", "snapshots", "enabled"]
prompt = "Enable Snapshots"
type = "confirm"

# Object Storage (conditional)
[[elements]]
condition = "installer_storage_backend == 'object_storage'"
default = "s3"
help = "Object storage provider"
name = "object_storage_provider"
nickel_path = ["installer", "storage", "object_storage", "provider"]
options = ["s3", "gcs", "azure_blob", "minio"]
prompt = "Object Storage Provider"
type = "select"

[[elements]]
condition = "installer_storage_backend == 'object_storage'"
default = ""
help = "Object storage endpoint URL"
name = "object_storage_endpoint"
nickel_path = ["installer", "storage", "object_storage", "endpoint"]
prompt = "Storage Endpoint"
required = true
type = "text"

[[elements]]
condition = "installer_storage_backend == 'object_storage'"
default = ""
help = "Object storage bucket name"
name = "object_storage_bucket"
nickel_path = ["installer", "storage", "object_storage", "bucket"]
prompt = "Storage Bucket"
required = true
type = "text"

[[elements]]
condition = "installer_storage_backend == 'object_storage'"
default = ""
help = "Object storage access key ID (will be encrypted)"
name = "object_storage_access_key"
nickel_path = ["installer", "storage", "object_storage", "access_key"]
prompt = "Access Key"
required = true
type = "password"

[[elements]]
condition = "installer_storage_backend == 'object_storage'"
default = ""
help = "Object storage secret access key (will be encrypted)"
name = "object_storage_secret_key"
nickel_path = ["installer", "storage", "object_storage", "secret_key"]
prompt = "Secret Key"
required = true
type = "password"

# Block Storage (conditional)
[[elements]]
condition = "installer_storage_backend == 'block_storage'"
default = "local"
help = "Block storage type"
name = "block_storage_type"
nickel_path = ["installer", "storage", "block_storage", "type"]
options = ["local", "san", "nas"]
prompt = "Block Storage Type"
type = "select"

[[elements]]
condition = "installer_storage_backend == 'block_storage'"
default = "/dev/sdb"
help = "Block device path"
name = "block_device_path"
nickel_path = ["installer", "storage", "block_storage", "device_path"]
prompt = "Block Device Path"
type = "text"

# Storage Compression and Encryption
[[elements]]
default = false
help = "Enable compression for stored data"
name = "storage_compression_enabled"
nickel_path = ["installer", "storage", "compression", "enabled"]
prompt = "Enable Compression"
type = "confirm"

[[elements]]
condition = "storage_compression_enabled == true"
default = "zstd"
help = "Compression algorithm"
name = "storage_compression_algorithm"
nickel_path = ["installer", "storage", "compression", "algorithm"]
options = ["zstd", "gzip", "snappy"]
prompt = "Compression Algorithm"
type = "select"

[[elements]]
default = true
help = "Enable encryption for stored data"
name = "storage_encryption_enabled"
nickel_path = ["installer", "storage", "encryption", "enabled"]
prompt = "Enable Encryption"
type = "confirm"

[[elements]]
condition = "storage_encryption_enabled == true"
default = "aes256"
help = "Encryption algorithm"
name = "storage_encryption_algorithm"
nickel_path = ["installer", "storage", "encryption", "algorithm"]
options = ["aes256", "chacha20"]
prompt = "Encryption Algorithm"
type = "select"

[[elements]]
condition = "storage_encryption_enabled == true"
default = "age"
help = "Key management system for encryption keys"
name = "storage_kms"
nickel_path = ["installer", "storage", "encryption", "kms"]
options = ["age", "sops", "vault", "kms"]
prompt = "Key Management"
type = "select"

# Storage Replication
[[elements]]
default = false
help = "Enable storage replication for redundancy"
name = "storage_replication_enabled"
nickel_path = ["installer", "storage", "replication", "enabled"]
prompt = "Enable Replication"
type = "confirm"

[[elements]]
condition = "storage_replication_enabled == true"
default = 3
help = "Number of replicas (range: 2-10)"
max = 10
min = 2
name = "storage_replication_factor"
nickel_path = ["installer", "storage", "replication", "factor"]
prompt = "Replication Factor"
type = "number"

[[elements]]
condition = "storage_replication_enabled == true"
default = "sync"
help = "Replication mode"
name = "storage_replication_mode"
nickel_path = ["installer", "storage", "replication", "mode"]
options = ["sync", "async", "hybrid"]
prompt = "Replication Mode"
type = "select"

# Storage Cleanup
[[elements]]
default = true
help = "Enable automatic cleanup of old data"
name = "storage_cleanup_enabled"
nickel_path = ["installer", "storage", "cleanup", "enabled"]
prompt = "Enable Cleanup"
type = "confirm"

[[elements]]
condition = "storage_cleanup_enabled == true"
default = 90
help = "Retention period for archived data in days"
max = 3650
min = 7
name = "storage_cleanup_retention_days"
nickel_path = ["installer", "storage", "cleanup", "retention_days"]
prompt = "Retention Period (days)"
type = "number"

[[elements]]
condition = "storage_cleanup_enabled == true"
default = "weekly"
help = "Cleanup schedule"
name = "storage_cleanup_schedule"
nickel_path = ["installer", "storage", "cleanup", "schedule"]
options = ["daily", "weekly", "monthly"]
prompt = "Cleanup Schedule"
type = "select"
