import Ember from 'ember'
import DS from 'ember-data'
businessDayComputations = (target, prefix, options = {}) ->
  if options.add_attributes
    Ember.defineProperty target, "#{prefix}_value", DS.attr('number', defaultValue: 0)
    Ember.defineProperty target, "#{prefix}_unit",  DS.attr('string', defaultValue: options.default_unit || 'day')
    Ember.defineProperty target, "#{prefix}_business_days", DS.attr(defaultValue: -> [ 1, 2, 3, 4, 5 ])
  #Ember.defineProperty target, "#{prefix}_business_days_index_sum", Ember.computed.sum "#{prefix}_business_days"
  #Ember.defineProperty target, "has_default_#{prefix}_business_days", Ember.computed "#{prefix}_business_days.length", "#{prefix}_business_days_index_sum", ->
  #  @get("#{prefix}_business_days.length") is 5 and @get("#{prefix}_business_days_index_sum") is 15
  #Ember.defineProperty target, "#{prefix}_unit_businessday", Ember.computed.equal "#{prefix}_unit", 'businessday'
  true

export default businessDayComputations
