# Environment-Specific Configuration Schema
# Type-safe environment definitions per ADR-003: Nickel as Source of Truth
#
# This module defines environment configurations with mandatory type safety.
# Environments inherit from base config and override specific values.
#
# Usage:
#   let provisioning = import "./main.ncl" in
#   provisioning.config.environments

# Environment configuration contract
let EnvironmentConfig = {
  # Debug settings
  debug_enabled | Bool = false,
  debug_log_level | String = "info",

  # Security settings
  strict_mode | Bool = false,
  require_approval | Bool = false,

  # Performance settings
  max_parallel_operations | Number = 4,
  operation_timeout_seconds | Number = 300,

  # Optional extra settings per environment
  extra | {..} = {},
} in

# Environment definitions
{
  # Development environment - permissive for faster iteration
  dev | EnvironmentConfig = {
    debug_enabled = true,
    debug_log_level = "debug",
    strict_mode = false,
    require_approval = false,
    max_parallel_operations = 8,
    operation_timeout_seconds = 600,
    extra = {},
  },

  # Staging environment - balanced between safety and usability
  staging | EnvironmentConfig = {
    debug_enabled = false,
    debug_log_level = "info",
    strict_mode = true,
    require_approval = true,
    max_parallel_operations = 4,
    operation_timeout_seconds = 300,
    extra = {},
  },

  # Production environment - strict safety and auditing
  prod | EnvironmentConfig = {
    debug_enabled = false,
    debug_log_level = "warn",
    strict_mode = true,
    require_approval = true,
    max_parallel_operations = 2,
    operation_timeout_seconds = 300,
    extra = {},
  },

  # Testing/CI environment - fast execution
  test | EnvironmentConfig = {
    debug_enabled = false,
    debug_log_level = "info",
    strict_mode = false,
    require_approval = false,
    max_parallel_operations = 8,
    operation_timeout_seconds = 120,
    extra = {},
  },

  # CI/CD environment - automated, minimal approval
  ci | EnvironmentConfig = {
    debug_enabled = false,
    debug_log_level = "warn",
    strict_mode = true,
    require_approval = false,
    max_parallel_operations = 4,
    operation_timeout_seconds = 600,
    extra = {},
  },
}
