resource aws_dynamodb_table slz_content_status {
  name           = "${var.name_prefix}-slz_content_status"
  billing_mode   = "PAY_PER_REQUEST"
  hash_key       = "UnitOfWorkID"
  range_key      = "ContentName"

  attribute {
    name = "UnitOfWorkID"
    type = "S"
  }

  attribute {
    name = "ContentName"
    type = "S"
  }

  attribute {
    name = "ContentStatus"
    type = "S"
  }

//  not indexed fields in terraform file are not allowed
//  attribute {
//    name = "JobID"
//    type = "S"
//  }
//
//  attribute {
//    name = "CreatedAt"
//    type = "S"
//  }
//
//  attribute {
//    name = "CompletedAt"
//    type = "S"
//  }

  global_secondary_index {
    name               = "ContentStatusIndex"
    hash_key           = "UnitOfWorkID"
    range_key          = "ContentStatus"
    projection_type    = "INCLUDE"
    non_key_attributes = ["ContentName, JobID"]
  }

  point_in_time_recovery {
    enabled = var.backups_enabled
  }

  tags = merge(
    var.tags,
    {
      "Name" = "${var.name_prefix}-slz_content_status"
    },
  )
}
