/* global registerBackward, DataProviderFacade */

registerBackward('1.0.6', 'Theme', function(control) {
    'use strict';

    if (DataProviderFacade.getCmsInfo().cmsName === 'Magento') {
        if (control.controls.mainContentAreaHome) {
            delete control.controls.mainContentAreaHome;
        }

        if (control.controls.contentContainerHome) {
            var containerItems = control.controls.contentContainerHome.items;
            for (var containerIndex = 0; containerIndex < containerItems.length; containerIndex++) {
                var columnItems = containerItems[containerIndex.toString()].items;
                for (var columnIndex = 0; columnIndex < columnItems.length; columnIndex++) {
                    if (columnItems[columnIndex.toString()] === '/controls/mainContentAreaHome') {
                        columnItems[columnIndex.toString()] = '/controls/featuredSlider';
                    }
                }
            }
        }
    }

    return control;
});