variable "aws_region" {
  description = "AWS region"
  default     = "us-east-1"
}

variable "environment" {
  description = "Available values:  dev, qa, prod."
  default     = "prod"
}

variable "service_name" {
  default = "assets-transcoding-v2"
}

variable "lambda_service_name" {
  default = "lambda-assets"
}

variable "application_family" {
  default = "assets"
}

variable "vpc_id" {
  description = "VPC ID where the lambdas will execute: prod (vpc-7f0e841a)"
  type        = string
  default     = "vpc-7f0e841a"
}

variable "vpc_subnet_ids" {
  description = "VPC subnet IDs where the lambdas will execute"
  type        = list(string)
  default     = ["subnet-043d235081c966332", "subnet-067a6b45b079d7296"]
}

variable "cdc_msk_cluster_name" {
  description = "MSK cluster name"
  default     = "prod-managed-kafka-cdc-destination"
}

variable "cdc_msk_cluster_uuid" {
  description = "MSK cluster uuid"
  default     = "b103e027-ec75-4982-8d15-5bddc5e33831-6"
}

variable "msk_asset_flac_topic_name" {
  default = "stream.asset.mezzanine.audio.flac"
}

variable "msk_asset_mezzanine_coverart_topic_name" {
  description = "asset mezzanine coverart MSK topic name"
  default     = "stream.asset.mezzanine.coverart"
}

variable "raw_assets_s3_bucket_suffix" {
  description = "Suffix for the S3 bucket storing raw assets."
  type        = string
  default     = "orcd-raw-assets"
}

variable "mezzanine_assets_s3_bucket_suffix" {
  description = "Suffix for the S3 bucket storing mezzanine assets."
  type        = string
  default     = "orcd-mezzanine-assets"
}

variable "cloudfront_logging_bucket" {
  description = "Bucket to use for cloudfront logging"
  default     = "prod-orcd-cloudfront-logs.s3.amazonaws.com"
}

variable "state_machine_definition_file" {
  default     = "state-machine-definition.json"
  description = "JSON file representing the state machine"
}

variable "guardduty_event_rule_pattern_file" {
  default     = "guardduty-event-rule-pattern.json"
  description = "JSON file representing the GuardDuty Malware Protection scan-result event rule"
}

variable "s3_event_rule_pattern_file" {
  default     = "s3-event-rule-pattern.json"
  description = "JSON file representing the raw S3 Object Created event rule (fallback)"
}

# For a lossless switch between triggers, enable the incoming one first and apply,
# leave both enabled for at least the GuardDuty scan latency(observed - up to 10 minutes), then disable the
# outgoing one and apply. The pipeline dedups, so the overlap is harmless.
variable "enable_s3_trigger" {
  type        = bool
  default     = true
  description = "Enable the raw S3 Object Created trigger."
}

variable "enable_guardduty_trigger" {
  type        = bool
  default     = false
  description = "Enable the GuardDuty Malware Protection scan-result trigger."
}

locals {
  tags = {
    environment        = var.environment
    service_name       = var.service_name
    env                = var.environment
    service            = var.service_name
    application_family = var.application_family
    terraformed        = true
  }

  raw_assets_s3_bucket       = "${var.environment}-${var.raw_assets_s3_bucket_suffix}"
  mezzanine_assets_s3_bucket = "${var.environment}-${var.mezzanine_assets_s3_bucket_suffix}"
  seconds_in_a_day           = 60 * 60 * 24
  max_concurrency            = 50
}

variable "notification_endpoints" {
  default = "@slack-content-delivery-and-asset-mgmt-alerts"
}

variable "escalation_notification_endpoints" {
  default = "@slack-content-delivery-and-asset-mgmt-alerts"
}

