output "s3_bucket_name_output" {
  description = "Name of S3 bucket"
  value       = aws_s3_bucket.bucket.id
}

output "s3_bucket_arn_output" {
  description = "ARN of S3 bucket"
  value       = aws_s3_bucket.bucket.arn
}

output "s3_bucket_domain_name_output" {
  description = "Domain name of S3 bucket"
  value       = aws_s3_bucket.bucket.bucket_domain_name
}

output "s3_bucket_regional_domain_name_output" {
  description = "Regional domain name of S3 bucket"
  value       = aws_s3_bucket.bucket.bucket_regional_domain_name
}

output "s3_kms_encryption_key_arn_output" {
  description = "ARN of KMS encryption key"
  value       = length(aws_kms_key.kms_key) > 0 ? aws_kms_key.kms_key[0].arn : ""
  depends_on  = [aws_kms_key.kms_key]
}

output "s3_kms_encryption_key_id_output" {
  description = "ID of KMS encryption key"
  value       = length(aws_kms_key.kms_key) > 0 ? aws_kms_key.kms_key[0].key_id : ""
  depends_on  = [aws_kms_key.kms_key]
}

output "s3_read_only_policy_arn_output" {
  description = "ARN of read-only policy"
  value       = var.s3_read_only_policy ? aws_iam_policy.s3_read_only_policy.0.arn : null
}

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

output "s3_replication_role_arn_output" {
  description = "ARN of replication role"
  value       = length(local.config_replication) > 0 ? aws_iam_role.s3_replication_role[0].arn : null
}
