{% for environment in env_collection.active_environments %}
{% for resource in environment.dynamodb_resources %}
{% if resource.is_dynamodb %}

variable "{{ resource.instance_name }}_billing_mode" {
  description = "The billing mode for the DynamoDB table"
  type        = string
  default     = "{{ resource.settings.billing_mode | default('PROVISIONED') }}"
}

variable "{{ resource.instance_name }}_hash_key" {
  description = "The hash key for the DynamoDB table"
  type        = string
  default = "{{ resource.settings.hash_key | default('UserID') }}"
}

variable "{{ resource.instance_name }}_read_capacity" {
  description = "The read capacity for the DynamoDB table"
  type        = number
  default     = "{{ resource.settings.read_capacity | default(5)}}"
}

variable "{{ resource.instance_name }}_write_capacity" {
  description = "The write capacity for the DynamoDB table"
  type        = number
  default     = "{{ resource.settings.write_capacity | default(5)}}"
}

variable "{{ resource.instance_name }}_attributes" {
  description = "The attributes for the DynamoDB table"
  type = list(object({
    name = string
    type = string
  }))
  default = [ {
    name = "UserID"
    type = "S"
  } ]
}

variable "{{ resource.instance_name }}_global_secondary_indexes" {
  description = "The global secondary indexes for the DynamoDB table"
  type        = list(object({
    name            = string
    hash_key        = string
    range_key       = string
    read_capacity   = number
    write_capacity  = number
    projection_type = string
  }))
  default     = []
}

variable "{{ resource.instance_name }}_deletion_protection_enabled" {
  description = "Whether to enable deletion protection for the DynamoDB table"
  type        = string
  default     = "{{ resource.settings.deletion_protection_enabled | default('false')}}"
}

variable "{{ resource.instance_name }}_table_class" {
  description = "The class of the DynamoDB table"
  type        = string
  default     = "{{ resource.settings.table_class | default('STANDARD') }}"
}

variable "{{ resource.instance_name }}_point_in_time_recovery_enabled" {
  description = "Whether to enable point-in-time recovery for the DynamoDB table"
  type        = bool
  default     = false
}

variable "{{ resource.instance_name }}_ttl_enabled" {
  description = "Whether to enable TTL for the DynamoDB table"
  type        = bool
  default     = false
}

variable "{{ resource.instance_name }}_ttl_attribute_name" {
  description = "The name of the TTL attribute for the DynamoDB table"
  type        = string
  default     = ""
}

{% endif %}
{% endfor %}
{% endfor %}
