# General variables
variable "environment" {
  description = "Name of the environment, e.g. dev, qa, prod"
  default     = "dev"
}

variable "service_name" {
  description = "Service name, without environment prefix"
  default     = "neo4j-service"
}

variable "instance" {
  description = "Instance on Neo4j Aura"
  default     = "auradb"
}

variable "teams" {
  type        = set(string)
  description = "A set of Datadog Teams to associate the resources with"
  default     = []
}

variable "dependent_applications" {
  type        = set(string)
  description = "Any dependent application."
  default     = ["auradb"]
}

# Variables for all monitors
# Alert variables
variable "notification_endpoints" {
  description = "Endpoints for alerts. Can be email, slack, pagerduty, etc"
  default     = "@slack-neo4j-db"
}

variable "escalation_notification_endpoints" {
  description = "Endpoints for escalation alerts. Can be email, slack, pagerduty, etc"
  default     = "@slack-neo4j-db"
}

variable "page_cache_hit_ratio_enabled" {
  description = "Whether to enable page cache hit ratio monitoring"
  default     = true
}
variable "critical_page_cache_hit_ratio_lower_than" {
  description = "Percentage critical threshold for page cache hit ratio"
  default     = 95
}

variable "cpu_usage_enabled" {
  description = "Whether to enable CPU usage monitoring"
  default     = true
}
variable "critical_cpu_usage" {
  description = "Percentage critical threshold for CPU usage"
  default     = 95
}
variable "heap_used_enabled" {
  description = "Whether to enable heap used monitoring"
  default     = true
}
variable "critical_heap_used" {
  description = "Critical threshold for Heap used percentage"
  default     = 85
}
variable "query_failures_enabled" {
  description = "Whether to enable query failures monitoring"
  default     = true
}
variable "warning_query_failures" {
  description = "Percentage warning threshold for query failures"
  default     = 5
}
variable "critical_query_failures" {
  description = "Percentage critical threshold for query failures"
  default     = 25
}
variable "db_store_size_enabled" {
  description = "Whether to enable DB store size monitoring"
  default     = true
}
variable "critical_db_store_size" {
  description = "Critical threshold for DB store size in percentage of total disk size"
  default     = 85
}


locals {
  pde_datadog_url = "https://sonymusic-pde.datadoghq.com"

  tags = flatten([
    "env:${var.environment}",
    "environment:${var.environment}",
    "service:${var.service_name}",
    "service_name:${var.service_name}",
    [for team in var.teams : "team:${team}"],
    [for dependent_application in var.dependent_applications : "dependent_application:${dependent_application}"]
  ])

}
