################################################################################
# Module: agentidp
# Outputs
################################################################################

# ── AWS Outputs ──────────────────────────────────────────────────────────────

output "aws_ecs_cluster_arn" {
  description = "ARN of the ECS cluster hosting the AgentIdP service."
  value       = var.provider_type == "aws" ? aws_ecs_cluster.main[0].arn : null
}

output "aws_ecs_service_name" {
  description = "Name of the ECS Fargate service."
  value       = var.provider_type == "aws" ? aws_ecs_service.app[0].name : null
}

output "aws_ecs_task_definition_arn" {
  description = "ARN of the active ECS task definition revision."
  value       = var.provider_type == "aws" ? aws_ecs_task_definition.app[0].arn : null
}

output "aws_app_security_group_id" {
  description = "Security group ID attached to the ECS tasks. Use this to add ingress rules from the ALB."
  value       = var.provider_type == "aws" ? aws_security_group.app[0].id : null
}

output "aws_cloudwatch_log_group_name" {
  description = "CloudWatch log group name for ECS container logs."
  value       = var.provider_type == "aws" ? aws_cloudwatch_log_group.app[0].name : null
}

# ── GCP Outputs ──────────────────────────────────────────────────────────────

output "gcp_cloud_run_service_name" {
  description = "Name of the Cloud Run service."
  value       = var.provider_type == "gcp" ? google_cloud_run_v2_service.app[0].name : null
}

output "gcp_cloud_run_service_url" {
  description = "Publicly accessible HTTPS URL of the Cloud Run service (Google-managed TLS)."
  value       = var.provider_type == "gcp" ? google_cloud_run_v2_service.app[0].uri : null
}

output "gcp_cloud_run_service_id" {
  description = "Full resource ID of the Cloud Run service."
  value       = var.provider_type == "gcp" ? google_cloud_run_v2_service.app[0].id : null
}

# ── Unified Outputs ───────────────────────────────────────────────────────────

output "service_url" {
  description = "Publicly accessible service URL. Populated for GCP (Cloud Run native URL). For AWS use the ALB DNS name from the lb module."
  value       = var.provider_type == "gcp" ? google_cloud_run_v2_service.app[0].uri : null
}
