import { r as registerInstance, e as createEvent, h } from './index-ee578edf.js';
import { S as StateOfReminder } from './utils-cc62d8e2.js';

const addonReminderFooterCss = ":host{display:block}.reminder-footer{display:flex;background-color:#F7F9FC;height:115px;width:100%;border-radius:0 0 10px 10px}.avatar{width:45px;height:45px}.avatar-maggioli{border-radius:0}.items-container{margin-top:auto;display:flex;flex-direction:column;width:300px;height:100px;margin-left:auto;color:#334C79;font-family:Karla, serif;font-weight:bold}.buttons-container{display:flex;flex-direction:row;width:300px;height:70px;margin-left:auto;margin-top:auto}.hidden{display:none}.buttons-container-view{display:flex;width:300px;height:70px;margin-left:auto;margin-top:auto}.items-container-view{margin-top:auto;display:flex;flex-direction:column;width:250px;height:100px;margin-left:auto;color:#334C79;font-family:Karla, serif;font-weight:bold}.author-container{margin-top:auto;display:flex;flex-direction:column;width:300px;height:100px;margin-left:3rem;color:#334C79;font-family:Karla, serif;font-weight:bold}.info-author{margin-top:0.5rem;display:flex;flex-direction:row}.text-info{color:#4C72B3;font-size:14px;font-weight:normal;margin-left:0.4rem;margin-top:0.2rem;display:flex;flex-direction:column}";

const AddonReminderFooter = class {
  constructor(hostRef) {
    registerInstance(this, hostRef);
    this.createReminderEmitter = createEvent(this, "createReminderEmitter", 7);
    this.createReminderEmitterFromSubmit = createEvent(this, "createReminderEmitterFromSubmit", 7);
    this.undoReminderEmitter = createEvent(this, "undoReminderEmitter", 7);
    this.reminderDoneEmitter = createEvent(this, "reminderDoneEmitter", 7);
    this.errorEmitter = createEvent(this, "errorEmitter", 7);
    this.editReminderEmitterFromSubmit = createEvent(this, "editReminderEmitterFromSubmit", 7);
    this.reminderDoneProp = false;
    this.reminderDone = false;
    this.controlParam = false;
    this.submitValidation = false;
    this.reminderAddonInfo = null;
  }
  switchReminderDone() {
    if (this.status === StateOfReminder.view) {
      this.reminderDone = !this.reminderDone;
      this.reminderDoneEmitter.emit(this.reminderDone);
    }
  }
  componentWillRender() {
    this.reminderDone = this.reminderDoneProp;
    this.status = this.state;
  }
  componentWillUpdate() {
    if (this.reminderAddonInfo.hour && this.reminderAddonInfo.minute && this.reminderAddonInfo.duration && this.reminderAddonInfo.description && this.reminderAddonInfo.date && this.reminderAddonInfo.name) {
      this.errorEmitter.emit(false);
      this.controlParam = true;
    }
    else {
      this.controlParam = false;
    }
  }
  componentShouldUpdate() {
    this.status = this.state;
  }
  undoReminder() {
    this.undoReminderEmitter.emit(true);
  }
  editReminder() {
    let output = Object.assign({}, this.reminderAddonInfo);
    output.author = this.author;
    this.editReminderEmitterFromSubmit.emit(output);
    this.createReminderEmitter.emit('view');
  }
  createReminder() {
    console.log('controlParam: ', this.submitValidation);
    if (this.submitValidation) {
      this.errorEmitter.emit(false);
      let output = Object.assign({}, this.reminderAddonInfo);
      output.author = this.author;
      this.createReminderEmitterFromSubmit.emit(output);
      this.createReminderEmitter.emit('view');
    }
    else {
      this.errorEmitter.emit(true);
    }
  }
  render() {
    // defineCustomElements(window);
    if (this.status === StateOfReminder.create) {
      return (h("div", { class: "reminder-footer" }, h("div", { class: "items-container" }, "Azioni", h("div", { class: "buttons-container" }, h("input-button", { onClick: () => this.undoReminder(), icon: false, text: "Annulla" }), h("input-button", { onClick: () => this.createReminder(), icon: true, dark: true, text: "Crea" })))));
    }
    else if (this.status === StateOfReminder.view) {
      return (h("div", { class: "reminder-footer" }, h("div", { class: "author-container" }, "Utenti", h("div", { class: "info-author" }, h("div", { class: "avatar" }, h("mds-avatar", { class: "avatar-maggioli", initials: "https://www.boorp.com/avatars_100x100_for_myspace/25.png", src: "https://www.boorp.com/avatars_100x100_for_myspace/25.png" })), h("div", { class: "text-info" }, h("div", null, "Modificato da ", h("b", null, this.author.name, " ", this.author.surname)), h("div", null, this.author.date)))), h("div", { class: "items-container-view" }, "Azioni", h("div", { class: "buttons-container-view" }, h("input-button", { size: "200px", class: { 'generic': true, 'hidden': this.reminderDone === true }, icon: false, dark: true, text: "Segna come completato" }), h("input-button", { size: "200px", class: { 'generic': true, 'hidden': this.reminderDone === false }, icon: false, text: "Non completato" })))));
    }
    else {
      return (h("div", { class: "reminder-footer" }, h("div", { class: "items-container" }, "Azioni", h("div", { class: "buttons-container" }, h("input-button", { onClick: () => this.undoReminder(), icon: false, text: "Annulla" }), h("input-button", { onClick: () => this.editReminder(), icon: true, dark: true, text: "Modifica" })))));
    }
  }
};
AddonReminderFooter.style = addonReminderFooterCss;

export { AddonReminderFooter as addon_reminder_footer };
