/* exported Theme */
/*global WrapperController, Picture, JQueryLibrary, Bootstrap, ControlsDictionary, ContainerInner, ThemeInfo, ShortCodeEditor, PropertyObserverController */

function Theme() {
    'use strict';
    this.favicon = new Picture();
    this.additionalHead = '';
    this.additionalCmsCode = '';
    this.info = new ThemeInfo();
    this.direction = 'ltr';
    this.jQuery = new JQueryLibrary();
    this.bootstrap = new Bootstrap();
    this.gridContainerInner = new ContainerInner();
    this.templates = new ControlsDictionary();
    this.controls = new ControlsDictionary();
    this.prototypes = new ControlsDictionary();
    PropertyObserverController.defineProperty(this.prototypes, 'shortCode_editor', {
        enumerable: true,
        value: new ShortCodeEditor()
    });
    WrapperController.make(this, Theme);
    this.version = '1.0.0';
    this.css('TypographyTextLinkPassive', 'color', '@bd-link-color');
    this.css('TypographyTextLinkHovered', 'color', '@bd-link-color-hover');
    this.css('TypographyTextLinkHovered', 'text-decoration', 'underline');
}

Theme.prototype.beforeBuild = function () {
    'use strict';
    this.prop('_buttonClassNames', this.find('prototypes.ButtonMixin').prop('classNames'));
    this.prop('_imageClassNames', this.find('prototypes.ImageMixin').prop('classNames'));

    // TODO
    if (this.hasSubControl('prototypes.carousel')) {
        this.prop('_carousel', {
            classNames : this.find('prototypes.carousel').prop('classNames'),
            iconClassNames : this.find('prototypes.carousel.icon').prop('classNames'),
            leftButtonSelector : 'bd-left-button',
            rightButtonSelector : 'bd-right-button'
        });
    }

    // TODO
    if (this.hasSubControl('prototypes.indicators')) {
        this.prop('_indicators',{
            classNames : this.find('prototypes.indicators').prop('classNames'),
            itemClassNames : this.find('prototypes.indicators.item').prop('classNames')
        });
    }

    if (this.hasSubControl('prototypes.Accordion')) {
        this.prop('_accordion', {
            classNames: this.find('prototypes.Accordion').prop('classNames'),
            selector: this.find('prototypes.Accordion').prop('selector'),
            item: {
                classNames: this.find('prototypes.Accordion.item').prop('classNames'),
                selector: this.find('prototypes.Accordion.item').prop('selector')
            },
            content: {
                classNames: this.find('prototypes.Accordion.content').prop('classNames'),
                selector: this.find('prototypes.Accordion.content').prop('selector')
            }
        });
    }

    this.find('templates').prop('_denyBuild', true);
    this.find('controls').prop('_denyBuild', true);
    this.find('prototypes').prop('_denyBuild', true);
};