/// class PD.Actions.ActionParameterDefinition

PD.Actions.ActionParameterDefinition = Class.extend({

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

    _options: null,

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

    init: function (options) {

        this._options = _.extend({
            name: null,
            type: PD.Actions.ActionParameterType.STRING,
            description: null,
            optional: false
        }, options);

    },

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

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

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

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

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

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

    toLiteral: function (data) {

        return _.extend({
            name: this.get_name(),
            type: this.get_type(),
            description: this.get_description(),
            optional: this.get_optional()
        }, data || {});

    },

    toParameter: function (value, text) {

        var args = this.toLiteral({
            value: value,
            text: text
        });

        return new PD.Actions.ActionParameter(args);

    }

});

PD.Actions.ActionParameterType = {
    BOOLEAN: 1,
    DATE: 2,
    DECIMAL: 3,
    INTEGER: 4,
    STRING: 5
};

PD.Actions.ActionParameterType.getName = function (type) {

    var result = null;

    switch (type) {
        case PD.Actions.ActionParameterType.BOOLEAN:
            result = "Boolean";
            break;
        case PD.Actions.ActionParameterType.DATE:
            result = "Date";
            break;
        case PD.Actions.ActionParameterType.DECIMAL:
            result = "Decimal";
            break;
        case PD.Actions.ActionParameterType.INTEGER:
            result = "Integer";
            break;
        case PD.Actions.ActionParameterType.STRING:
            result = "Text";
            break;
        default:
            result = "Not Specified"
    }

    return result;

};