# PostgreSQL Database Configuration Fragment
# Used by: control-center, installer (when backend = postgresql)

[[elements]]
border_bottom = false
border_top = true
name = "database_section_header"
title = "💾 PostgreSQL Database Configuration"
type = "section_header"

[[elements]]
default = "postgresql"
help = "Database backend type"
name = "database_backend"
nickel_path = ["database", "backend"]
prompt = "Database Backend"
type = "text"

[[elements]]
help = "PostgreSQL connection string or host"
name = "database_postgres_host"
nickel_path = ["database", "host"]
placeholder = "localhost"
prompt = "PostgreSQL Host"
required = true
type = "text"

[[elements]]
default = 5432
help = "PostgreSQL port number (range: ${constraint.common.server.port.min}-${constraint.common.server.port.max})"
max = "${constraint.common.server.port.max}"
min = "${constraint.common.server.port.min}"
name = "database_postgres_port"
nickel_path = ["database", "port"]
prompt = "PostgreSQL Port"
type = "number"

[[elements]]
help = "PostgreSQL database name"
name = "database_postgres_database"
nickel_path = ["database", "database"]
placeholder = "provisioning"
prompt = "Database Name"
required = true
type = "text"

[[elements]]
help = "PostgreSQL username"
name = "database_postgres_user"
nickel_path = ["database", "user"]
placeholder = "provisioning"
prompt = "Username"
required = true
type = "text"

[[elements]]
help = "PostgreSQL password (will be stored securely)"
name = "database_postgres_password"
nickel_path = ["database", "password"]
prompt = "Password"
type = "password"

[[elements]]
default = 10
help = "Database connection pool size (range: 5-200)"
max = 200
min = 5
name = "database_pool_size"
nickel_path = ["database", "pool_size"]
prompt = "Connection Pool Size"
type = "number"

[[elements]]
default = 30
help = "Database operation timeout in seconds (range: 10-3600)"
max = 3600
min = 10
name = "database_timeout"
nickel_path = ["database", "timeout"]
prompt = "Timeout (seconds)"
type = "number"

[[elements]]
default = 3
help = "Number of retry attempts for failed operations (range: 0-10)"
max = 10
min = 0
name = "database_retry_attempts"
nickel_path = ["database", "retry_attempts"]
prompt = "Retry Attempts"
type = "number"

[[elements]]
default = 100
help = "Delay in milliseconds between retry attempts (range: 1000-60000)"
max = 60000
min = 1000
name = "database_retry_delay"
nickel_path = ["database", "retry_delay"]
prompt = "Retry Delay (ms)"
type = "number"
