# Terraform variables for The Order infrastructure

variable "environment" {
  description = "Environment name (dev, stage, prod)"
  type        = string
  validation {
    condition     = contains(["dev", "stage", "prod"], var.environment)
    error_message = "Environment must be dev, stage, or prod."
  }
}

variable "azure_region" {
  description = "Azure region (default: westeurope, no US regions allowed)"
  type        = string
  default     = "westeurope"
  
  validation {
    condition     = !can(regex("^us", var.azure_region))
    error_message = "US Commercial and Government regions are not allowed. Use European or other non-US regions."
  }
  
  validation {
    condition = contains([
      "westeurope", "northeurope", "uksouth", "switzerlandnorth",
      "norwayeast", "francecentral", "germanywestcentral"
    ], var.azure_region)
    error_message = "Region must be one of the supported non-US regions. See naming convention documentation."
  }
}

variable "project_name" {
  description = "Project name"
  type        = string
  default     = "the-order"
}

variable "domain_name" {
  description = "Domain name for the application"
  type        = string
  default     = ""
}

variable "subscription_id" {
  description = "Azure subscription ID"
  type        = string
  default     = ""
  sensitive   = true
}

variable "tenant_id" {
  description = "Azure tenant ID"
  type        = string
  default     = ""
  sensitive   = true
}

variable "client_id" {
  description = "Azure service principal client ID (optional, uses Azure CLI auth if not set)"
  type        = string
  default     = ""
  sensitive   = true
}

variable "client_secret" {
  description = "Azure service principal client secret (optional, uses Azure CLI auth if not set)"
  type        = string
  default     = ""
  sensitive   = true
}

variable "resource_group_name" {
  description = "Azure resource group name"
  type        = string
  default     = ""
}

variable "storage_account_name" {
  description = "Azure storage account name (must be globally unique)"
  type        = string
  default     = ""
}

variable "key_vault_name" {
  description = "Azure Key Vault name (must be globally unique)"
  type        = string
  default     = ""
}

variable "tags" {
  description = "Tags to apply to all resources"
  type        = map(string)
  default = {
    Environment = "dev"
    Project     = "the-order"
    ManagedBy   = "terraform"
  }
}

variable "cdn_profile_name" {
  description = "Azure CDN profile name"
  type        = string
  default     = ""
}

variable "cdn_endpoint_name" {
  description = "Azure CDN endpoint name"
  type        = string
  default     = ""
}

variable "enable_monitoring" {
  description = "Enable monitoring and observability"
  type        = bool
  default     = true
}

variable "enable_logging" {
  description = "Enable centralized logging"
  type        = bool
  default     = true
}

variable "create_terraform_state_rg" {
  description = "Create resource group for Terraform state storage"
  type        = bool
  default     = true
}

variable "create_terraform_state_storage" {
  description = "Create storage account for Terraform state backend"
  type        = bool
  default     = true
}

