variable "trail_name" {
  description = "Name of the CloudTrail trail"
  type        = string
  default     = "org-trail"
}

variable "s3_bucket_name" {
  description = "Name of the S3 bucket for CloudTrail log delivery"
  type        = string
}

variable "s3_key_prefix" {
  description = "S3 key prefix for CloudTrail log objects"
  type        = string
  default     = "cloudtrail"
}

variable "is_organization_trail" {
  description = "Enable organization-level trail spanning all member accounts"
  type        = bool
  default     = true
}

variable "is_multi_region_trail" {
  description = "Capture events from all regions"
  type        = bool
  default     = true
}

variable "include_global_service_events" {
  description = "Include global service events (IAM, STS, etc.)"
  type        = bool
  default     = true
}

variable "enable_log_file_validation" {
  description = "Enable log file integrity validation"
  type        = bool
  default     = true
}

variable "cloudwatch_logs_retention_days" {
  description = "Retention period in days for the CloudWatch log group"
  type        = number
  default     = 365
}

variable "kms_key_id" {
  description = "KMS key ARN for trail log encryption (optional)"
  type        = string
  default     = null
}

variable "management_events_rw_type" {
  description = "Read/Write type for management events — All, ReadOnly, WriteOnly, or None"
  type        = string
  default     = "All"
}

variable "data_resources" {
  description = <<-EOT
    Data event resources to capture. Map key is a logical name.
    type is the CloudTrail resource type (e.g. AWS::S3::Object).
    values is the list of ARNs or ARN prefixes to include.
    EOT
  type = map(object({
    type   = string
    values = list(string)
  }))
  default = {
    all_s3 = {
      type   = "AWS::S3::Object"
      values = ["arn:aws:s3:::"]
    }
    all_lambda = {
      type   = "AWS::Lambda::Function"
      values = ["arn:aws:lambda"]
    }
  }
}

variable "tags" {
  description = "Resource tags to apply to all resources"
  type        = map(string)
  default     = {}
}
