## addSuperBucket.r

addSuperBucket_ <- function(DT) {

  ## UPDATE:  Not going to change all theses DTs
  return(invisible(DT))
}



cleanBuckets_ <- function(DT) {

  ## Error check
  if (!("store_musicbucket" %in% names(DT)))
    stop(capture.output(substitute(DT)), " does not contain column named 'store_musicbucket'")

  ## Physical should be considered its own musicbucket
  if ("ancillaryline" %in% names(DT)) {
    DT[ancillaryline == "Physical", store_musicbucket := "Physical"]
  }

  ## superbucket should start as a clone of bucket
  DT[, store_musicsuperbucket := store_musicbucket]

  ## Combine Streaming with Other Services
  DT[ store_musicsuperbucket %in% c("Streaming", "Other Services")
    , store_musicsuperbucket := "Streaming & other services" ]

  ## Combine Download with Physical
  DT[ store_musicsuperbucket %in% c("Download", "Physical")
    , store_musicsuperbucket := "Download (w. Physical)" ]

  return(invisible(DT))
}
