import Ember from 'ember';
import renderMaterialChart from '../utils/render-material-chart';
import renderClassicChart from '../utils/render-classic-chart';

const { set, getProperties, isBlank } = Ember;

export default Ember.Mixin.create({

  init() {
    this._super(...arguments);
    this._setRenderChart();
  }, 

  _setRenderChart() {
    let {design, defaultDesign} = getProperties(this, ['design', 'defaultDesign'])
      , renderChartList = {'classic': renderClassicChart, 'material': renderMaterialChart}
      , renderChartSelected = renderChartList[isBlank(design) ? defaultDesign : design];

    set(this, 'renderChart', renderChartSelected);
  },

});

@@ -181,21 +181,31 @@
 ties, is
-Blank
+Present, assert
  %7D = Emb
@@ -571,13 +571,15 @@
 t%5Bis
-Blank
+Present
 (des
@@ -584,16 +584,25 @@
 esign) ?
+ design :
  default
@@ -611,20 +611,130 @@
 sign
- : design%5D;%0A
+%5D%0A      , isValidRenderchart = isPresent(renderChartSelected);%0A%0A    assert(%60Invalid 'design' value.%60, isValidRenderchart);
 %0A   

validate 'design' attribute value