/// class ProspectDirector.Web.UI.FeatureSets.EditorAssemblerBase

/**
@class EditorAssemblerBase
@namespace Web.UI.FeatureSets
@constructor
**/
ProspectDirector.Web.UI.FeatureSets.EditorAssemblerBase = Class.extend({

    //==============================
    // FIELDS
    //==============================

    _id: null,
    _isActivated: null,
    _validationErrors: null,

    //==============================
    // CONSTRUCTOR
    //==============================

    init: function (options) {
        this._options = options;
        this._id = uuid.v4();
    },

    //==============================
    // PROPERTIES
    //==============================

    get_id: function () {
        return this._id;
    },

    get_featureSet: function () {
        return this.get_options().featureSet;
    },

    get_container: function () {
        return $("#" + this.get_options().containerId).find("DIV[data-id=" + this.get_groupId() + "][data-role=assembler-container]");
    },

    get_groupId: function () {
        return this.get_options().groupId;
    },

    get_options: function () {
        return this._options;
    },

    get_domNode: function () {
        return this.get_container().find("#" + this.get_id());
    },

    get_validationErrors: function () {
        return this._validationErrors;
    },

    //==============================
    // PUBLIC METHODS
    //==============================

    resize: function () {
        //must override
    },

    render: function () {
        return this.DOM().render();
    },

    focus: function () {

        var that = this;

        if (this._isActivated) {
            this.resize();
        }
        else {
            this.DOM().showLoadingMessage(true);
            this.activate();
            this.resize();
            this.DOM().showLoadingMessage(false);
        }

    },

    activate: function () {
        this._isActivated = true;
    },

    setValidationErrors: function (validationErrors) {
        this._validationErrors = validationErrors;
    },

    DOM: function () {

        if (!this._DOM) {
            this._DOM = new ProspectDirector.Web.UI.FeatureSets.EditorAssemblerBaseDOM({
                containerID: this.get_options().containerId,
                groupId: this.get_groupId(),
                id: this.get_id()
            });
        }

        return this._DOM;

    }

});