variable "clusters" {
  description = "Map of Redshift cluster definitions"
  type = map(object({
    cluster_identifier                   = string
    database_name                        = string
    master_username                      = string
    node_type                            = optional(string, "ra3.xlplus")
    cluster_type                         = optional(string, "multi-node")
    number_of_nodes                      = optional(number, 2)
    port                                 = optional(number, 5439)
    allow_version_upgrade                = optional(bool, true)
    publicly_accessible                  = optional(bool, false)
    encrypted                            = optional(bool, true)
    kms_key_id                           = optional(string, null)
    enhanced_vpc_routing                 = optional(bool, true)
    automated_snapshot_retention_period  = optional(number, 7)
    preferred_maintenance_window         = optional(string, "sun:05:00-sun:05:30")
    skip_final_snapshot                  = optional(bool, false)
    final_snapshot_identifier            = optional(string, null)
    snapshot_cluster_identifier          = optional(string, null)
    snapshot_identifier                  = optional(string, null)
    availability_zone                    = optional(string, null)
    availability_zone_relocation_enabled = optional(bool, false)
    iam_roles                            = optional(list(string), [])
    logging = optional(object({
      enable        = optional(bool, true)
      bucket_name   = optional(string, null)
      s3_key_prefix = optional(string, "redshift/")
    }), null)
    subnet_group_name      = optional(string, null)
    parameter_group_name   = optional(string, null)
    vpc_security_group_ids = optional(list(string), [])
  }))
  default = {}
}

variable "subnet_groups" {
  description = "Map of Redshift subnet group definitions"
  type = map(object({
    name        = string
    description = optional(string, "")
    subnet_ids  = list(string)
  }))
  default = {}
}

variable "parameter_groups" {
  description = "Map of Redshift parameter group definitions"
  type = map(object({
    name        = string
    family      = optional(string, "redshift-1.0")
    description = optional(string, "")
    parameters  = optional(map(string), {})
  }))
  default = {}
}

variable "scheduled_actions" {
  description = "Map of Redshift scheduled action definitions (pause/resume)"
  type = map(object({
    name         = string
    cluster_key  = string
    schedule     = string
    action_type  = string
    iam_role_arn = string
    pause        = optional(bool, null)
    resize = optional(object({
      node_type       = string
      number_of_nodes = number
      cluster_type    = string
    }), null)
  }))
  default = {}
}

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