# Terraform outputs for The Order infrastructure

output "environment" {
  description = "Environment name"
  value       = var.environment
}

output "project_name" {
  description = "Project name"
  value       = var.project_name
}

output "azure_region" {
  description = "Azure region being used"
  value       = var.azure_region
}

output "region_abbreviation" {
  description = "Region abbreviation used in naming"
  value       = local.region_short
}

output "resource_group_name" {
  description = "Main resource group name (az-we-rg-dev-main)"
  value       = azurerm_resource_group.main.name
}

output "resource_group_id" {
  description = "Main resource group ID"
  value       = azurerm_resource_group.main.id
}

output "storage_account_name" {
  description = "Application data storage account name (azwesadevdata)"
  value       = azurerm_storage_account.app_data.name
}

output "storage_account_id" {
  description = "Application data storage account ID"
  value       = azurerm_storage_account.app_data.id
}

output "terraform_state_storage_account_name" {
  description = "Terraform state storage account name (azwesadevstate)"
  value       = var.create_terraform_state_storage ? azurerm_storage_account.terraform_state[0].name : null
}

output "terraform_state_resource_group_name" {
  description = "Terraform state resource group name (az-we-rg-dev-state)"
  value       = var.create_terraform_state_rg ? azurerm_resource_group.terraform_state[0].name : null
}

output "terraform_state_storage_container_name" {
  description = "Terraform state storage container name (if created)"
  value       = var.create_terraform_state_storage ? azurerm_storage_container.terraform_state[0].name : null
}

# Naming convention outputs for reference
output "naming_convention" {
  description = "Naming convention pattern used"
  value = {
    pattern = "{provider}-{region}-{resource}-{env}-{purpose}"
    provider = local.provider
    region_abbrev = local.region_short
    env_abbrev = local.env_short
    examples = {
      resource_group = local.rg_name
      storage_account = local.sa_data_name
      key_vault = local.kv_name
      aks_cluster = local.aks_name
      container_registry = local.acr_name
    }
  }
}
