
ProspectDirector.Web.UI.FeatureSets.ValidationError = Class.extend({

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

    _data: null,
    _groupId: null,
    _featureType: null,
    _propertyName: null,
    _message: null,

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

    init: function (data) {
        this._data = data;
        this._fill(data);
    },

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

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

    get_featureType: function () {
        return this._featureType;
    },

    get_feature: function () {
        return this._data.feature;
    },

    get_propertyName: function () {
        return this._propertyName;
    },

    get_message: function () {
        return this._message;
    },

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

    toJSON: function () {
        return this._data.error
    },

    //================================
    // PRIVATE METHODS
    //================================

    _fill: function (data) {
        this._groupId = this.get_feature().get_parent().get_id();
        this._featureType = this.get_feature().get_binding();
        this._propertyName = ProspectDirector.Web.UI.FeatureSets.ValidationErrorKey.getFeatureProperty(data.error.key);
        this._message = data.error.message;
    }

});