import { unsafeCSS, LitElement, nothing, html } from "lit";
import { property } from "lit/decorators.js";
import { customElement } from "../../decorator.js";
import componentStyle from "./advice-message-item.css.js";
import { ObcTopbarMessageItemType } from "../topbar-message-item/topbar-message-item.js";
import "../../icons/icon-notification-advice-active.js";
import "../../icons/icon-close-google.js";
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __decorateClass = (decorators, target, key, kind) => {
  var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc(target, key) : target;
  for (var i = decorators.length - 1, decorator; i >= 0; i--)
    if (decorator = decorators[i])
      result = (kind ? decorator(target, key, result) : decorator(result)) || result;
  if (kind && result) __defProp(target, key, result);
  return result;
};
var ObcAdviceMessageItemType = /* @__PURE__ */ ((ObcAdviceMessageItemType2) => {
  ObcAdviceMessageItemType2["Simple"] = "simple";
  ObcAdviceMessageItemType2["WithButton"] = "with-button";
  ObcAdviceMessageItemType2["WithIconButton"] = "with-icon-button";
  ObcAdviceMessageItemType2["Inactive"] = "inactive";
  return ObcAdviceMessageItemType2;
})(ObcAdviceMessageItemType || {});
var ObcAdviceMessageItemSize = /* @__PURE__ */ ((ObcAdviceMessageItemSize2) => {
  ObcAdviceMessageItemSize2["Regular"] = "regular";
  ObcAdviceMessageItemSize2["Tall"] = "tall";
  return ObcAdviceMessageItemSize2;
})(ObcAdviceMessageItemSize || {});
let ObcAdviceMessageItem = class extends LitElement {
  constructor() {
    super(...arguments);
    this.title = "";
    this.description = "";
    this.time = "";
    this.timeSecondary = "";
    this.actionLabel = "View";
    this.type = "simple";
    this.size = "regular";
    this.showTitle = true;
    this.showDescription = true;
    this.showTimestamp = true;
    this.hasTimestamp2 = false;
    this.hasSecondaryIcon = false;
    this.emptyText = "No active advice";
  }
  get mappedType() {
    if (this.type === "inactive") {
      return ObcTopbarMessageItemType.Inactive;
    }
    switch (this.type) {
      case "with-button":
        return ObcTopbarMessageItemType.WithButton;
      case "with-icon-button":
        return ObcTopbarMessageItemType.WithIconButton;
      case "simple":
        return ObcTopbarMessageItemType.Simple;
      default:
        return ObcTopbarMessageItemType.Simple;
    }
  }
  /**
   * Fired when the main message area is clicked.
   * @fires message-click {CustomEvent<void>}
   */
  handleMessageClick() {
    this.dispatchEvent(new CustomEvent("message-click"));
  }
  /**
   * Fired when the action button (text or icon) is clicked.
   * @fires action-click {CustomEvent<void>}
   */
  handleActionClick() {
    this.dispatchEvent(new CustomEvent("action-click"));
  }
  render() {
    return html`
      <obc-topbar-message-item
        .type=${this.mappedType}
        .size=${this.size}
        .showTitle=${this.showTitle}
        .showDescription=${this.showDescription}
        .showTimestamp=${this.showTimestamp}
        .hasTimestamp2=${this.hasTimestamp2}
        .hasSecondaryIcon=${this.hasSecondaryIcon}
        @message-click=${this.handleMessageClick}
        @action-click=${this.handleActionClick}
      >
        <obi-notification-advice-active
          slot="primary-icon"
        ></obi-notification-advice-active>

        ${this.hasSecondaryIcon ? html`<slot name="secondary-icon" slot="secondary-icon"></slot>` : nothing}
        ${this.title && this.showTitle ? html`<span slot="title">${this.title}</span>` : nothing}
        ${this.description && this.showDescription ? html`<span slot="description">${this.description}</span>` : nothing}
        ${this.time && this.showTimestamp ? html`<span slot="time">${this.time}</span>` : nothing}
        ${this.timeSecondary && this.hasTimestamp2 ? html`<span slot="time-secondary">${this.timeSecondary}</span>` : nothing}
        ${this.type === "with-button" ? html`<span slot="action-text">${this.actionLabel}</span>` : this.type === "with-icon-button" ? html`<obi-close-google slot="action-icon"></obi-close-google>` : nothing}

        <span slot="empty">${this.emptyText}</span>
      </obc-topbar-message-item>
    `;
  }
};
ObcAdviceMessageItem.styles = unsafeCSS(componentStyle);
__decorateClass([
  property({ type: String })
], ObcAdviceMessageItem.prototype, "title", 2);
__decorateClass([
  property({ type: String })
], ObcAdviceMessageItem.prototype, "description", 2);
__decorateClass([
  property({ type: String })
], ObcAdviceMessageItem.prototype, "time", 2);
__decorateClass([
  property({ type: String })
], ObcAdviceMessageItem.prototype, "timeSecondary", 2);
__decorateClass([
  property({ type: String })
], ObcAdviceMessageItem.prototype, "actionLabel", 2);
__decorateClass([
  property({ type: String })
], ObcAdviceMessageItem.prototype, "type", 2);
__decorateClass([
  property({ type: String })
], ObcAdviceMessageItem.prototype, "size", 2);
__decorateClass([
  property({ type: Boolean, attribute: false })
], ObcAdviceMessageItem.prototype, "showTitle", 2);
__decorateClass([
  property({ type: Boolean, attribute: false })
], ObcAdviceMessageItem.prototype, "showDescription", 2);
__decorateClass([
  property({ type: Boolean, attribute: false })
], ObcAdviceMessageItem.prototype, "showTimestamp", 2);
__decorateClass([
  property({ type: Boolean })
], ObcAdviceMessageItem.prototype, "hasTimestamp2", 2);
__decorateClass([
  property({ type: Boolean })
], ObcAdviceMessageItem.prototype, "hasSecondaryIcon", 2);
__decorateClass([
  property({ type: String })
], ObcAdviceMessageItem.prototype, "emptyText", 2);
ObcAdviceMessageItem = __decorateClass([
  customElement("obc-advice-message-item")
], ObcAdviceMessageItem);
export {
  ObcAdviceMessageItem,
  ObcAdviceMessageItemSize,
  ObcAdviceMessageItemType
};
//# sourceMappingURL=advice-message-item.js.map
