import { unsafeCSS, LitElement, nothing, html } from "lit";
import { customElement } from "../../decorator.js";
import componentStyle from "./event-list.css.js";
import { property } from "lit/decorators.js";
import { repeat } from "lit/directives/repeat.js";
import { EventItemType } from "../event-item/event-item.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;
};
let ObcEventList = class extends LitElement {
  constructor() {
    super(...arguments);
    this.showHeader = true;
    this.date = /* @__PURE__ */ new Date();
    this.events = [];
  }
  /**
   * Get the normalized Date object (handles both Date and timestamp).
   */
  get _normalizedDate() {
    if (this.date instanceof Date) {
      return this.date;
    }
    return new Date(this.date);
  }
  /**
   * Get the formatted day name (e.g., "Saturday").
   */
  get _dayName() {
    return this._normalizedDate.toLocaleDateString(this.locale, {
      weekday: "long"
    });
  }
  /**
   * Get the formatted month name (e.g., "January").
   */
  get _monthName() {
    return this._normalizedDate.toLocaleDateString(this.locale, {
      month: "long"
    });
  }
  /**
   * Get the date number (e.g., "11").
   */
  get _dateNumber() {
    return this._normalizedDate.getDate().toString();
  }
  /**
   * Get the year (e.g., "2025").
   */
  get _year() {
    return this._normalizedDate.getFullYear().toString();
  }
  render() {
    return html`
      <div class="wrapper">
        ${this.showHeader ? html`
              <div class="title-container">
                <div class="label-container">
                  <div class="label">
                    <span class="day-container">
                      <span class="day">${this._dayName}</span>
                      <span class="comma">,</span>
                    </span>
                    <span class="date-container">
                      <span class="month">${this._monthName}</span>
                      <span class="date-value">
                        <span>${this._dateNumber}</span>
                        <span class="comma">,</span>
                      </span>
                    </span>
                    <span class="year">${this._year}</span>
                  </div>
                </div>
              </div>
            ` : nothing}
        <div class="spacer"></div>
        <div class="content-container">
          <div class="event-container" role="list" aria-label="Events">
            ${repeat(
      this.events,
      (event, index) => `${event.title}-${event.startTime}-${event.endTime}-${index}`,
      (event) => html`
                <obc-event-item
                  role="listitem"
                  .title=${event.title}
                  .description=${event.description ?? ""}
                  .startTime=${event.startTime}
                  .endTime=${event.endTime}
                  .eventItemType=${event.eventItemType ?? EventItemType.SingleLine}
                  .hasArrow=${event.hasArrow ?? false}
                  .hasTime=${event.hasTime ?? false}
                  .hasEndTime=${event.hasEndTime ?? false}
                  .aggregatedCount=${event.aggregatedCount ?? 0}
                  .colorCoded=${event.colorCoded ?? false}
                  .disabled=${event.disabled ?? false}
                ></obc-event-item>
              `
    )}
          </div>
        </div>
      </div>
    `;
  }
};
ObcEventList.styles = unsafeCSS(componentStyle);
__decorateClass([
  property({ type: Boolean, attribute: false })
], ObcEventList.prototype, "showHeader", 2);
__decorateClass([
  property({ attribute: false })
], ObcEventList.prototype, "date", 2);
__decorateClass([
  property({ attribute: false })
], ObcEventList.prototype, "events", 2);
__decorateClass([
  property({ type: String })
], ObcEventList.prototype, "locale", 2);
ObcEventList = __decorateClass([
  customElement("obc-event-list")
], ObcEventList);
export {
  ObcEventList
};
//# sourceMappingURL=event-list.js.map
