/* $Id: composer_image.js 10262 2014-06-05 19:47:29Z lucas $ */

(function() { // START NAMESPACE
var $ = 'id' in document ? document.id : window.$;
Composer.Plugin.IntopenaiImage = function(options){

  this.__proto__ = new Composer.Plugin.Interface(options)

  this.name = 'intopenaiImage';

  this.options = {
    title : 'Add Image Using AI',
    lang : {},
    requestOptions : false,
    fancyUploadEnabled : true,
    fancyUploadOptions : {}
  }

  this.allowToSetInInput = true;

  this.initialize = function(options) {
    this.elements = new Hash(this.elements);
    this.params = new Hash(this.params);
    this.__proto__.initialize.call(this,scriptJquery.extend(options,this.__proto__.options));
    
  }

  this.attach = function() {
    this.__proto__.attach.call(this);
    this.makeActivator();
    setTimeout(function() {
      scriptJquery("#compose-intopenaiImage-activator").attr("data-bs-target","#intopenaiimage");
      scriptJquery("#compose-intopenaiImage-activator").attr("data-bs-toggle","modal");
    },1000);
    return this;
  }

  this.detach = function() {
    this.__proto__.detach.call(this);
    return this;
  }

  this.activate = function() {
    if (this.active) {
      return;
    }

    this.__proto__.activate.call(this);
    this.makeMenu();
    this.makeBody();

  }

  this.deactivate = function() {
    if( !this.active ) return;
    this.uploadedPhotos = [];
    this.__proto__.deactivate.call(this);
  }

  this.initialize(options);
};

})(); // END NAMESPACE
