variable "name" {
  description = "Name prefix for the ASG and launch template"
  type        = string
}

variable "ami_id" {
  description = "AMI ID for the launch template"
  type        = string
}

variable "instance_type" {
  description = "EC2 instance type"
  type        = string
}

variable "security_group_ids" {
  description = "Security group IDs for launch template"
  type        = list(string)
}

variable "iam_instance_profile_arn" {
  description = "ARN of the IAM instance profile"
  type        = string
  default     = null
}

variable "key_name" {
  description = "EC2 key pair name"
  type        = string
  default     = null
}

variable "user_data" {
  description = "Base64-encoded user data"
  type        = string
  default     = null
}

variable "root_volume_size" {
  description = "Root EBS volume size in GiB"
  type        = number
  default     = 20
}

variable "root_volume_kms_key_id" {
  description = "KMS key ID for root volume encryption"
  type        = string
  default     = null
}

variable "metadata_http_tokens" {
  description = "IMDSv2 setting — required or optional"
  type        = string
  default     = "required"
}

variable "vpc_zone_identifier" {
  description = "List of subnet IDs for the ASG"
  type        = list(string)
}

variable "min_size" {
  description = "Minimum number of instances"
  type        = number
  default     = 1
}

variable "max_size" {
  description = "Maximum number of instances"
  type        = number
  default     = 3
}

variable "desired_capacity" {
  description = "Desired number of instances"
  type        = number
  default     = 1
}

variable "health_check_type" {
  description = "EC2 or ELB health check type"
  type        = string
  default     = "EC2"
}

variable "target_group_arns" {
  description = "ALB/NLB target group ARNs to associate"
  type        = list(string)
  default     = []
}

variable "scaling_policies" {
  description = "Map of target-tracking scaling policies"
  type = map(object({
    predefined_metric_type = optional(string, "ASGAverageCPUUtilization")
    target_value           = optional(number, 60)
    cooldown               = optional(number, 300)
  }))
  default = {}
}

variable "lifecycle_hooks" {
  description = "Map of lifecycle hooks"
  type = map(object({
    lifecycle_transition = string
    heartbeat_timeout    = optional(number, 60)
    default_result       = optional(string, "CONTINUE")
    notification_arn     = optional(string, null)
  }))
  default = {}
}

variable "warm_pool_enabled" {
  description = "Enable warm pool for faster scale-out"
  type        = bool
  default     = false
}

variable "warm_pool_min_size" {
  description = "Minimum number of instances in the warm pool"
  type        = number
  default     = 1
}

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