ProspectDirector.Modules.Security.AclDialog = (function (options) {

    var 

        PRIVATE = {

            //---------------------------
            //--- CONSTRUCTOR
            //---------------------------

            init: function (options) {

                PRIVATE.options = $.extend({
                    selector: null,
                    aceData: [],
                    permissionData: []
                }, options);

                PRIVATE.init_dialog();

            },

            //---------------------------
            //--- PROPERTIES
            //---------------------------

            get_dialog: function () {
                return $(PRIVATE.options.selector);
            },

            get_aclControlContainer: function () {
                return PRIVATE.get_dialog().find("DIV[data-id=acl-control]");
            },

            get_buttonCancel: function () {
                return PRIVATE.get_dialog().find("INPUT[data-command=cancel]");
            },

            get_buttonSave: function () {
                return PRIVATE.get_dialog().find("INPUT[data-command=save]");
            },

            //---------------------------
            //--- INITIALIZERS
            //---------------------------

            init_dialog: function () {

                PRIVATE.get_buttonCancel().on("click", $.proxy(PRIVATE.buttonCancel_onClick, PRIVATE));
                PRIVATE.get_buttonSave().on("click", $.proxy(PRIVATE.buttonSave_onClick, PRIVATE));

            },
            
            //---------------------------
            //--- EVENT HANDLERS
            //---------------------------

            buttonCancel_onClick: function (e) {
                PRIVATE.get_dialog().data("dialog").hide();
            },

            buttonSave_onClick: function (e) {
                
                PRIVATE.get_dialog().data("dialog").hide({
                    command: "ok",
                    data: PRIVATE.get_aclControlContainer().data("aclControl").getAcl()
                });

            }

        },

        PUBLIC = {

        };

    PRIVATE.init(options);

    return PUBLIC;


});