# MySQL database configuration fragment
# Conditional: when database_type == "mysql"

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

[[elements]]
custom_type = "u16"
default = "3306"
help = "Port number for MySQL server"
maximum = "65535"
minimum = "1024"
name = "mysql_port"
nickel_path = ["provisioning", "database", "mysql", "port"]
prompt = "MySQL port"
required = true
type = "custom"
when = "database_type == mysql"

[[elements]]
help = "MySQL database name"
name = "mysql_database"
nickel_path = ["provisioning", "database", "mysql", "database"]
placeholder = "myapp"
prompt = "Database name"
required = true
type = "text"
validation_pattern = "^[a-zA-Z0-9_]+$"
when = "database_type == mysql"

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

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

[[elements]]
custom_type = "u16"
default = "10"
help = "Maximum number of database connections (1-1000)"
maximum = "1000"
minimum = "1"
name = "mysql_pool_size"
nickel_path = ["provisioning", "database", "mysql", "pool_size"]
prompt = "Connection pool size"
required = true
type = "custom"
when = "database_type == mysql"

[[elements]]
default = "utf8mb4"
help = "MySQL character set"
name = "mysql_charset"
nickel_path = ["provisioning", "database", "mysql", "charset"]
prompt = "Character set"
required = true
type = "text"
when = "database_type == mysql"

[[elements]]
default = "utf8mb4_unicode_ci"
help = "MySQL collation"
name = "mysql_collation"
nickel_path = ["provisioning", "database", "mysql", "collation"]
prompt = "Collation"
required = true
type = "text"
when = "database_type == mysql"
