# Provisioning Defaults - General default values for all provisioning configs
# Version: 1.0.0
#
# These defaults can be merged with user configurations using std.record.merge
# or by using the default operator in schemas

{
  provisioning_defaults = {
    # Project defaults
    project = {
      version = "0.1.0",
      tags = [],
    },

    # Service defaults (applied to all services)
    service_defaults = {
      replicas = 1,
      restart_policy = 'unless-stopped,
      healthcheck = {
        enabled = true,
        endpoint = "/health",
        interval = 30,
        timeout = 10,
        retries = 3,
        start_period = 0,
      },
      environment = {},
      env_file = [],
      depends_on = [],
      volumes = [],
      networks = [],
      labels = {},
    },

    # Database defaults
    database = {
      type = 'none,
      migrations_path = "./migrations",
      auto_migrate = false,
    },

    # Network defaults
    network = {
      docker_networks = {},
      kubernetes_policies = [],
      dns_servers = [],
      dns_search = [],
    },

    # Storage defaults
    storage = {
      docker_volumes = {},
      volume_mounts = [],
      kubernetes_pvs = [],
      kubernetes_pvcs = [],
    },

    # Deployment defaults
    deployment = {
      target = 'docker,
      docker_compose = {
        enabled = true,
        version = '3.8,
        env_file = ".env",
        profiles = [],
      },
      kubernetes = {
        enabled = false,
        namespace = "default",
        create_namespace = false,
        service = {
          type = 'ClusterIP,
          annotations = {},
        },
        deployment_strategy = {
          type = 'RollingUpdate,
          rolling_update = {
            max_surge = "25%",
            max_unavailable = "25%",
          },
        },
        hpa = {
          enabled = false,
          min_replicas = 1,
          max_replicas = 10,
          target_cpu_utilization = 80,
        },
        pod_annotations = {},
        pod_labels = {},
        image_pull_secrets = [],
        node_selector = {},
        tolerations = [],
      },
    },

    # Monitoring defaults
    monitoring = {
      prometheus = {
        enabled = false,
        port = 9090,
        image = "prom/prometheus:latest",
        scrape_interval = "15s",
        evaluation_interval = "15s",
        retention = "15d",
        storage_path = "/prometheus",
        scrape_configs = [],
        rule_files = [],
        external_labels = {},
      },
      grafana = {
        enabled = false,
        port = 3000,
        image = "grafana/grafana:latest",
        admin_user = "admin",
        datasources = [],
        dashboards_path = "/etc/grafana/dashboards",
        plugins = [],
        environment = {},
        anonymous_access = false,
        serve_from_sub_path = false,
      },
      loki = {
        enabled = false,
        port = 3100,
        image = "grafana/loki:latest",
        storage_path = "/loki",
        retention_period = "7d",
      },
      jaeger = {
        enabled = false,
        collector_port = 14268,
        query_port = 16686,
        image = "jaegertracing/all-in-one:latest",
        sampling_strategy = 'const,
        sampling_param = 1.0,
      },
      alerts_path = "./alerts",
      dashboard_refresh_interval = "30s",
    },

    # Security defaults
    security = {
      tls = {
        enabled = false,
        min_version = 'TLSv1.2,
        max_version = 'TLSv1.3,
        cipher_suites = [],
        verify_client = false,
        auto_generate = false,
      },
      docker_secrets = [],
      kubernetes_secrets = [],
      auth = {
        method = 'none,
      },
      security_headers = {
        enable_hsts = true,
        hsts_max_age = 31536000,
        hsts_include_subdomains = true,
        enable_csp = true,
        csp_policy = "default-src 'self'",
        enable_xss_protection = true,
        enable_frame_options = true,
        frame_options_value = 'DENY,
        enable_content_type_nosniff = true,
        enable_referrer_policy = true,
        referrer_policy_value = 'strict-origin-when-cross-origin,
        custom_headers = {},
      },
      cors = {
        enabled = false,
        allowed_origins = ["*"],
        allowed_methods = ["GET", "POST", "PUT", "DELETE", "OPTIONS"],
        allowed_headers = ["*"],
        expose_headers = [],
        allow_credentials = false,
        max_age = 86400,
      },
      rate_limiting = {
        enabled = false,
        requests_per_second = 100,
        burst_size = 200,
        strategy = 'ip,
      },
    },

    # Global environment variables
    environment = {},

    # Metadata
    metadata = {
      schema_version = "1.0.0",
      custom = {},
    },
  },
}
