variable "env_config" {
  description = "Configuration object containing AWS account details and VPC settings"

  type = object({
    aws_account          = string
    env                  = string
    humand_vpc_id        = string
    public_cluster_name  = string
    private_cluster_name = string
    cidr_block           = string
  })
}

variable "docker_image" {
  description = "Docker image to deploy"
  type        = string
}

variable "lb_host_condition" {
  description = "Host to use in the condition for LB listener rule"
  type        = string
}

variable "secret_overrides" {
  description = "Overrides for environment-specific ssm secrets"
  type        = map(any)
  default     = {}
}

variable "environment_overrides" {
  description = "Overrides for environment-specific environment variables"
  type        = map(any)
  default     = {}
}

variable "spot_ratio" {
  description = "Ratio of Spot Fargate instances"
  type        = number
  default     = 0

  validation {
    condition     = var.spot_ratio >= 0 && var.spot_ratio <= 1
    error_message = "The spot_ratio must be a number between 0 and 1 (inclusive)."
  }
}

variable "cpu" {
  description = "Cpu of the ECS task"
  type        = number
  default     = 1024
}

variable "memory" {
  description = "Memory of the ECS task"
  type        = number
  default     = 2048
}

variable "enable_autoscaling" {
  description = "Enable autoscaling for the ECS service"
  type        = bool
  default     = true
}

variable "autoscaling_min_capacity" {
  description = "Minimum number of tasks for autoscaling"
  type        = number
  default     = 1
}

variable "autoscaling_max_capacity" {
  description = "Maximum number of tasks for autoscaling"
  type        = number
  default     = 2
}

variable "cpu_target_utilization_percent" {
  description = "Target CPU utilization percentage for autoscaling"
  type        = number
  default     = 50
}

variable "scale_in_cooldown" {
  description = "Cooldown period for scale in operations (in seconds)"
  type        = number
  default     = 300
}

variable "scale_out_cooldown" {
  description = "Cooldown period for scale out operations (in seconds)"
  type        = number
  default     = 300
}
