/**
 * Base.Autocomplete 1.0
 *
 * Requiere
 *     Base 1.0
 */
$(function() {

    $.extend(Base, {
        Autocomplete : {

            //Los Datos debende vernir en un Json {id: '', label : ''}
            create: function (selector, options) {

                var _i18n = {
                    language: {}
                };

                _i18n = $.extend(true, _i18n, Base.i18n.autocomplete);

                if (options._i18n !== undefined && options._i18n != null) {
                    _i18n = $.extend(true, _i18n, options._i18n);
                }

                var defaultOptions = {
                    method: 'POST',
                    wrapperClass: "bc-wrapper",
                    menuClass: "bc-menu",
                    idField: true, //idFieldName set value to (idFieldName options) if idField=false
                    minLength: 3,
                    dataParams: {},
                    formParams: {},
                    clearIdFieldOnKeyUp: true
                };

                var finallyOptions = $.extend(true, defaultOptions, options);

                return $(selector).bootcomplete(finallyOptions);
            },

            _qxAutocomplete : function (autocomplete) {

                return {

                    ver : function () {

                        console.log("Base.Autocomplete 1.0");
                        console.log("Requiere: Base 1.0");
                    }
                }
            }
        }
    });

    $.fn.QxAutocomplete = function () {

        var autocomplete = this;

        return Base.Modal._qxAutocomplete(autocomplete);
    }
});