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

variable "region" {
  default     = "us-east-1"
  description = "aws resources region"
}

variable "service_name" {
  description = "Service name"
  default     = "lambda-vector"
}

variable "vpc_id" {
  type        = string
  description = "VPC ID"
  default     = "vpc-7f0e841a"
}

variable "application_family" {
  type        = string
  description = "Name of application family"
  default     = "vector"
}

variable "vpc_subnet_ids" {
  type        = list(any)
  description = "VPC subnet IDs where the lambdas will execute"
  default     = ["subnet-cb4dbae0", "subnet-5366ef24"]
}

variable "datadog_enabled" {
  description = "Whether or not to attach datadog secretsmanager IAM policy"
  default     = true
}

variable "datadog_advanced_enabled" {
  description = "Enabled DataDog monitoring."
  default     = true
}

variable "lambda_close_batch_name" {
  description = "Close batch lambda name"
  default     = "close-batch"
}

variable "lambda_find_batch_to_close_name" {
  description = "Find batch to close lambda name"
  default     = "find-batch-to-close"
}

variable "lambda_default_timeout" {
  description = "Default value for timeout"
  default     = "300"
}

variable "lambda_concurrent_executions" {
  description = "Number of lambda concurent executions"
  default     = 10
}

variable "lambda_memory_size" {
  description = "Memory size for the lambda function"
  default     = "512"
}

variable "event_source_mapping_queue_name" {
  description = "SQS queue name for lambda w/o ENV prefix."
  default     = "batch_to_close-queue"
}

variable "sqs_message_batch_size" {
  description = "Number of messages to send to lambda"
  default     = 1
}

variable "lambda_ready_deliveries_name" {
  description = "Ready deliveries lambda name"
  default     = "ready-deliveries"
}

variable "lambda_ready_deliveries_manager_name" {
  description = "Ready deliveries manager lambda name"
  default     = "ready-deliveries-manager"
}

variable "lambda_queue_tagger_name" {
  description = "SQS queue tagger lambda name"
  default     = "queue-tagger"
}

# Ready deliveries error monitor excluding folder creation errors
## Errors Threshold

variable "critical_number_ready_deliveries_errors" {
  description = "Ready deliveries number of errors for critical alerts"
  default     = 5
}

variable "warning_number_ready_deliveries_errors" {
  description = "Ready deliveries number of errors for warnings"
  default     = 2
}

variable "ok_number_ready_deliveries_errors" {
  description = "Ready deliveries number of errors that is ok"
  default     = 0
}

# Remote folder creation monitor
## Errors threshold
variable "critical_number_remote_folder_creation" {
  description = "Remote folder creation errors considered critical"
  default     = 1
}

variable "ok_number_remote_folder_creation" {
  description = "Remote folder creation errors considered ok"
  default     = 0
}

# Dms connection timeout monitor
## Errors threshold
variable "critical_number_dms_connection_timeout" {
  description = "DMS connection timeout errors considered critical"
  default     = 1
}

variable "ok_number_dms_connection_timeout" {
  description = "DMS connection timeout errors considered ok"
  default     = 0
}

# Renew outage monitor
## Outage threshold
variable "renew_outage_threshold_critical" {
  description = "Number of runs for critical status"
  default     = 0
}

variable "renew_outage_threshold_ok" {
  description = "Number of runs for an ok status"
  default     = 1
}

variable "renew_outage_notification_endpoint" {
  description = "Pagerduty endpoint for renew lambda outage"
  default     = "@oncall-content-delivery-asset-management"
}

# Ready deliveries outage monitor
## Outage threshold
variable "ready_deliveries_outage_threshold_critical" {
  description = "Number of runs for critical status"
  default     = 0
}

variable "ready_deliveries_outage_threshold_ok" {
  description = "Number of runs for an ok status"
  default     = 1
}

variable "ready_deliveries_outage_notification_endpoint" {
  description = "Pagerduty endpoint for ready deliveries lambda outage"
  default     = "@oncall-content-delivery-asset-management"
}

# Throttler outage monitor
## Outage threshold
variable "throttler_outage_threshold_critical" {
  description = "Number of runs for critical status"
  default     = 0
}

variable "throttler_outage_threshold_ok" {
  description = "Number of runs for an ok status"
  default     = 1
}

variable "throttler_outage_notification_endpoint" {
  description = "Pagerduty endpoint for throttler lambda outage"
  default     = "@oncall-content-delivery-asset-management"
}

# AR to DDB sync outage monitor
## Outage threshold
variable "ar_to_ddb_sync_outage_threshold_critical" {
  description = "Number of runs for critical status"
  default     = 0
}

variable "ar_to_ddb_sync_outage_threshold_ok" {
  description = "Number of runs for an ok status"
  default     = 1
}

# Notification endpoints
variable "ops_alert_notification_endpoint" {
  type        = string
  description = "Endpoints for alerts. Can be email, slack, pagerduty, etc"
  default     = "@slack-ops-alerts"
}

variable "ar_mysql_host" {
  default = "ar-db.theorchard.com"
}

variable "ar_mysql_port" {
  default = "3306"
}

variable "ar_mysql_database" {
  default = "art_relations"
}

variable "dd_mysql_host" {
  default = "dd-db.theorchard.com"
}

variable "dd_mysql_port" {
  default = "3306"
}

variable "dd_mysql_database" {
  default = "direct_delivery"
}

# This env var exists because, if this is deployed to dev, then
# the secretsmanager library will look for an api_key env var
variable "api_key" {
  description = "API key for the splitio"
  default     = ""
}

variable "datadog_secret_names" {
  type = list(string)
  default = [
    "DATADOG_APP_KEY",
    "DATADOG_API_KEY",
  ]
}

variable "mysql_dddb_secret_names" {
  type = list(string)
  default = [
    "DD_MYSQL_PASSWORD",
  ]
}

variable "mysql_ardb_secret_names" {
  type = list(string)
  default = [
    "AR_MYSQL_PASSWORD",
  ]
}

variable "lambda_ar_to_ddb_sync_name" {
  description = "ar-to-ddb-sync lambda name"
  default     = "ar-to-ddb-sync"
}

variable "orders_ddb_table" {
  description = "Orders dynamodb table name"
  default     = "vector-orders"
}

variable "orders_s3_bucket" {
  description = "Orders s3 bucket name"
  default     = "orcdbucket"
}

variable "order_encoder_id_list" {
  description = "Encoder ID list"
  default     = "17,18,19,23"
}

variable "ready_deliveries_secret_names" {
  type = list(string)
  default = [
    "PK_QA_V25DD",
    "PK_ID_RSA_451",
    "PK_ID_RSA",
    "PK_ID_DSA_YOUTUBE",
    "PK_ASPERA_TOKENAUTH_ID_RSA",
    "PK_ID_DSA",
  ]
}

variable "dd_mysql_user_throttler" {
  default = "vector_rw_lambda"
}

variable "secrets_throttler" {
  description = "List of secrets manager secrets to create"
  type        = list(string)
  default = [
    "RO_DD_MYSQL_PASSWORD",
    "DD_MYSQL_PASSWORD"
  ]
}

variable "physical_locations" {
  default = "13"
}

variable "secrets_find_batch_to_close" {
  type = list(string)
  default = [
    "DD_MYSQL_USER",
    "DD_MYSQL_PASSWORD"
  ]
}

variable "secrets_close_batch" {
  type = list(string)
  default = [
    "PK_QA_V25DD",
    "PK_ID_RSA_451",
    "PK_ID_RSA",
    "PK_ID_DSA_YOUTUBE",
    "PK_ASPERA_TOKENAUTH_ID_RSA",
    "PK_ID_DSA",
    "DD_MYSQL_USER",
    "DD_MYSQL_PASSWORD",
    "AR_MYSQL_USER",
    "AR_MYSQL_PASSWORD"
  ]
}

variable "secrets_job_priority_rule_match" {
  description = "List of secrets manager secrets to create"
  type        = list(string)
  default = [
    "AR_MYSQL_USER",
    "AR_MYSQL_PASSWORD",
    "DD_MYSQL_USER",
    "DD_MYSQL_PASSWORD"
  ]
}

variable "dd_mysql_limit" {
  default = "10000"
}

variable "stores_with_disabled_algorithms" {
  description = "Stores ID to disable SFTP rsa-sha2-256, rsa-sha2-512 algorithms"
  default     = "453,523,569,575,581,698,752,838"
}

variable "vector_orders_dynamo_table_stream_name" {
  description = "Vector orders Dynamo table stream name"
  default     = "2017-10-16T16:48:08.717"
}

variable "secrets_save_to_dd_db" {
  type = list(string)
  default = [
    "DD_MYSQL_USER",
    "DD_MYSQL_PASSWORD"
  ]
}

variable "healthy_tasks_notification_endpoints" {
  default = "@oncall-content-delivery-asset-management"
}

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

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

variable "paging_notification_endpoints" {
  default = "@oncall-content-delivery-asset-management"
}
