# General settings
variable "environment" {
  type        = string
  description = "Available values: dev, qa, prod."
}

variable "service_name" {
  type        = string
  description = "Name of service"
  default     = "dynamodb-backup-vault"
}

# Backup settings
variable "default_rule_schedule" {
  type        = string
  description = "Backup schedule in AWS cron format (UTC)"
  default     = "cron(0 5 * * ? *)"
}


variable "default_rule_start_window_minutes" {
  type        = number
  description = "Specifies the number of minutes before beginning a backup"
  default     = null
}

variable "default_rule_completion_window_minutes" {
  type        = number
  description = "Specifies the number of minutes the backup window has to complete"
  default     = null
}

variable "default_rule_cold_storage_after_days" {
  type        = number
  description = "Specifies the number of days after creation that a recovery point is moved to cold storage"
  default     = 30
}

variable "default_rule_delete_after_days" {
  type        = number
  description = "Specifies the number of days after creation that a recovery point is deleted. Must be 90 days greater than var.backup_cold_storage_after_days"
  default     = 365
}

variable "default_rule_tag" {
  description = "tag for selecting which tables to backup"
  type        = map(string)
  default = {
    key   = "default_backup"
    value = "true"
  }
}

variable "copy_into_principals" {
  description = "Allow these accounts to copy backups into this vault"
  type        = list(string)
  default = [
    "arn:aws:iam::437795906767:root"
  ]
}

variable "application_family" {
  type        = string
  description = "Application family to which this service belongs"
}

variable "backup_selection_type" {
  description = "Defines the selection type: 'tag' or 'arn'."
  type        = string
  default     = "tag"
}

variable "resource_arns" {
  description = "List of ARNs for backup selection (only applicable if backup_selection_type is 'arn')."
  type        = list(string)
  default     = []
}

variable "enable_backup_copy" {
  description = "Enable or disable copying backups to an external account vault."
  type        = bool
  default     = false
}

variable "destination_vault_arn" {
  description = "ARN of the external backup vault where backups will be copied."
  type        = string
  default     = ""
}

variable "create_backup_plan" {
  description = "Flag to enable or disable the creation of a backup plan."
  type        = bool
  default     = true
}

locals {
  name_prefix = "${var.environment}-${var.service_name}"
  tags = {
    Name               = "${local.name_prefix}"
    environment        = var.environment
    service_name       = var.service_name
    terraformed        = "true"
    application_family = var.application_family
  }
}
