# SurrealDB database configuration fragment
# Conditional: when database_type == "surrealdb"

[[elements]]
type = "text"
name = "surrealdb_host"
prompt = "SurrealDB host"
help = "Hostname or IP address of SurrealDB server"
default = "localhost"
nickel_path = ["provisioning", "database", "surrealdb", "host"]
required = true
when = "database_type == surrealdb"

[[elements]]
type = "custom"
custom_type = "u16"
name = "surrealdb_port"
prompt = "SurrealDB port"
help = "Port number for SurrealDB server"
default = "8000"
minimum = "1024"
maximum = "65535"
nickel_path = ["provisioning", "database", "surrealdb", "port"]
required = true
when = "database_type == surrealdb"

[[elements]]
type = "text"
name = "surrealdb_namespace"
prompt = "Namespace"
help = "SurrealDB namespace"
placeholder = "myapp"
nickel_path = ["provisioning", "database", "surrealdb", "namespace"]
required = true
when = "database_type == surrealdb"

[[elements]]
type = "text"
name = "surrealdb_database"
prompt = "Database name"
help = "SurrealDB database name"
placeholder = "main"
nickel_path = ["provisioning", "database", "surrealdb", "database"]
required = true
when = "database_type == surrealdb"

[[elements]]
type = "text"
name = "surrealdb_username"
prompt = "Database username"
help = "SurrealDB username for authentication"
default = "root"
nickel_path = ["provisioning", "database", "surrealdb", "username"]
required = true
when = "database_type == surrealdb"

[[elements]]
type = "password"
name = "surrealdb_password"
prompt = "Database password"
help = "SurrealDB password (min 8 characters)"
nickel_path = ["provisioning", "database", "surrealdb", "password"]
required = true
when = "database_type == surrealdb"

[[elements]]
type = "select"
name = "surrealdb_protocol"
prompt = "Connection protocol"
help = "Protocol for connecting to SurrealDB"
options = ["http", "https", "ws", "wss"]
default = "http"
nickel_path = ["provisioning", "database", "surrealdb", "protocol"]
required = true
when = "database_type == surrealdb"
