################################################################################
# Environment: aws
# Outputs
################################################################################

output "alb_dns_name" {
  description = "DNS name of the Application Load Balancer."
  value       = module.lb.alb_dns_name
}

output "service_url" {
  description = "Public HTTPS URL of the AgentIdP service."
  value       = "https://${var.domain_name}"
}

output "ecs_cluster_arn" {
  description = "ARN of the ECS cluster."
  value       = module.agentidp.aws_ecs_cluster_arn
}

output "ecs_service_name" {
  description = "Name of the ECS Fargate service."
  value       = module.agentidp.aws_ecs_service_name
}

output "ecs_task_definition_arn" {
  description = "Active ECS task definition ARN."
  value       = module.agentidp.aws_ecs_task_definition_arn
}

output "rds_endpoint" {
  description = "RDS PostgreSQL endpoint hostname."
  value       = module.rds.endpoint
}

output "rds_port" {
  description = "RDS PostgreSQL port."
  value       = module.rds.port
}

output "rds_instance_id" {
  description = "RDS instance identifier."
  value       = module.rds.instance_id
}

output "redis_primary_endpoint" {
  description = "ElastiCache Redis primary endpoint hostname."
  value       = module.redis.primary_endpoint
}

output "redis_reader_endpoint" {
  description = "ElastiCache Redis reader endpoint."
  value       = module.redis.reader_endpoint
}

output "vpc_id" {
  description = "ID of the VPC created for this deployment."
  value       = aws_vpc.main.id
}

output "private_subnet_ids" {
  description = "IDs of the private subnets (ECS, RDS, Redis)."
  value       = aws_subnet.private[*].id
}

output "public_subnet_ids" {
  description = "IDs of the public subnets (ALB)."
  value       = aws_subnet.public[*].id
}

output "cloudwatch_log_group" {
  description = "CloudWatch log group for ECS container logs."
  value       = module.agentidp.aws_cloudwatch_log_group_name
}

output "secrets_manager_database_url_arn" {
  description = "ARN of the Secrets Manager secret holding DATABASE_URL."
  value       = aws_secretsmanager_secret.database_url.arn
}

output "secrets_manager_redis_url_arn" {
  description = "ARN of the Secrets Manager secret holding REDIS_URL."
  value       = aws_secretsmanager_secret.redis_url.arn
}
