import { h } from "@stencil/core";
import "@maggioli-design-system/mds-button/dist/mds-button/mds-button";
import "@maggioli-design-system/mds-avatar/dist/mds-avatar/mds-avatar";
import "@maggioli-design-system/mds-text/dist/mds-text/mds-text";
import { Actions, States } from "src/utils/utils";
export class SwActionFooter {
  constructor() {
    this.imgBaseUrl = "/services/eolo-api-documentsmanaging/api/profile-image/get/";
    this.imageprofile = "";
    this.author = {
      name: "",
      surname: "",
      imageName: "",
    };
    this.status = undefined;
  }
  componentWillRender() {
    this.imageprofile =
      "/services/eolo-api-documentsmanaging/api/profile-image/get/" +
        this.author.imageName;
  }
  render() {
    var _a, _b;
    return (h("div", null, h("div", { class: {
        flex: true,
        "end-position": this.status === States.create,
      } }, this.status === States.view || this.status === States.edit ? (h("div", { class: "grow" }, h("mds-text", { typography: "caption", class: "block text-brand-synbee-eolo-v1-04 mb-2" }, h("strong", null, "Creatore")), h("mds-avatar", { class: "w-10 rounded-md", initials: "https://app.dev.synbee.it/it/assets/img/user.svg", src: this.author.imageName
        ? this.imgBaseUrl + this.author.imageName
        : "https://app.dev.synbee.it/it/assets/img/user.svg" }), h("mds-text", { typography: "caption", class: "text-brand-synbee-eolo-v1-04 ml-2 text-avatar" }, h("strong", null, (_a = this.author) === null || _a === void 0 ? void 0 :
      _a.name, " ", (_b = this.author) === null || _b === void 0 ? void 0 :
      _b.surname)))) : undefined, this.status === States.create || this.status === States.edit ? (h("div", { class: "flex flex-col" }, h("mds-text", { typography: "caption", class: "font-bold text-brand-synbee-eolo-v1-04 mb-2" }, "Azioni"), h("div", { class: "flex" }, h("mds-button", { onClick: () => {
        switch (this.status) {
          case States.create:
            this.emitCancel.emit(Actions.delete);
            break;
          case States.edit:
            this.emitCancel.emit(Actions.cancel);
            break;
        }
      }, class: "bg-brand-synbee-eolo-v1-17 text-brand-synbee-eolo-v1-06 mr-2 font-normal" }, "Annulla"), h("mds-button", { onClick: () => this.emitSave.emit(), class: "bg-brand-synbee-eolo-04" }, "Salva")))) : undefined)));
  }
  static get is() { return "sw-action-footer"; }
  static get encapsulation() { return "shadow"; }
  static get originalStyleUrls() {
    return {
      "$": ["sw-action-footer.css"]
    };
  }
  static get styleUrls() {
    return {
      "$": ["sw-action-footer.css"]
    };
  }
  static get properties() {
    return {
      "author": {
        "type": "unknown",
        "mutable": true,
        "complexType": {
          "original": "AuthorCreatorDTO",
          "resolved": "AuthorCreatorDTO",
          "references": {
            "AuthorCreatorDTO": {
              "location": "import",
              "path": "src/interfaces"
            }
          }
        },
        "required": false,
        "optional": false,
        "docs": {
          "tags": [],
          "text": ""
        },
        "defaultValue": "{\n    name: \"\",\n    surname: \"\",\n    imageName: \"\",\n  }"
      },
      "status": {
        "type": "string",
        "mutable": false,
        "complexType": {
          "original": "States",
          "resolved": "States.create | States.edit | States.view",
          "references": {
            "States": {
              "location": "import",
              "path": "src/utils/utils"
            }
          }
        },
        "required": false,
        "optional": false,
        "docs": {
          "tags": [],
          "text": ""
        },
        "attribute": "status",
        "reflect": false
      }
    };
  }
  static get events() {
    return [{
        "method": "emitSave",
        "name": "emitSave",
        "bubbles": true,
        "cancelable": true,
        "composed": true,
        "docs": {
          "tags": [],
          "text": ""
        },
        "complexType": {
          "original": "void",
          "resolved": "void",
          "references": {}
        }
      }, {
        "method": "emitCancel",
        "name": "emitCancel",
        "bubbles": true,
        "cancelable": true,
        "composed": true,
        "docs": {
          "tags": [],
          "text": ""
        },
        "complexType": {
          "original": "Actions",
          "resolved": "Actions.cancel | Actions.delete",
          "references": {
            "Actions": {
              "location": "import",
              "path": "src/utils/utils"
            }
          }
        }
      }];
  }
}
