# Security Group outputs
output "load_balancer_security_group_id" {
  description = "ID of the load balancer security group"
  value       = aws_security_group.load_balancer_security_group.id
}

# Load Balancer outputs
output "load_balancer_id" {
  description = "ID of the application load balancer"
  value       = aws_lb.application_load_balancer.id
}

output "load_balancer_arn" {
  description = "ARN of the application load balancer"
  value       = aws_lb.application_load_balancer.arn
}

output "load_balancer_dns_name" {
  description = "DNS name of the application load balancer"
  value       = aws_lb.application_load_balancer.dns_name
}

output "load_balancer_zone_id" {
  description = "Zone ID of the application load balancer"
  value       = aws_lb.application_load_balancer.zone_id
}

# Target Group outputs
output "target_group_arn" {
  description = "ARN of the target group"
  value       = aws_lb_target_group.s3_endpoint_ip_target_group.arn
}

output "target_group_name" {
  description = "Name of the target group"
  value       = aws_lb_target_group.s3_endpoint_ip_target_group.name
}

# Listener outputs
output "https_listener_arn" {
  description = "ARN of the HTTPS listener"
  value       = aws_lb_listener.load_balancer_https_listener.arn
}

# S3 Bucket outputs
output "s3_bucket_arn" {
  description = "ARN of the S3 bucket"
  value       = module.s3_bucket.s3_bucket_arn_output
}

output "s3_bucket_name" {
  description = "Name of the S3 bucket"
  value       = module.s3_bucket.s3_bucket_name_output
}

output "s3_bucket_domain_name" {
  description = "Domain name of the S3 bucket"
  value       = module.s3_bucket.s3_bucket_domain_name_output
}

output "s3_read_only_policy_name_output" {
  description = "Name of read-only policy"
  value       =  var.s3_read_only_policy ? module.s3_bucket.s3_read_only_policy_name_output : null
}

output "s3_replication_role_arn_output" {
  description = "ARN of replication role"
  value       = var.s3_apply_replication_configuration != null ? module.s3_bucket.s3_replication_role_arn_output : null
}

# Route53 outputs
output "route53_record_name" {
  description = "Name of the Route53 DNS record"
  value       = var.route53_record_enabled ? aws_route53_record.alb_service[0].name : null
}

output "route53_record_fqdn" {
  description = "FQDN of the Route53 DNS record"
  value       = var.route53_record_enabled ? aws_route53_record.alb_service[0].fqdn : null
}
