import { LitElement, html, nothing, css, unsafeCSS } from "lit";
import { property } from "lit/decorators.js";
import styles from "./styles.css?inline";

export class PrimariaCharacterLimitBadge extends LitElement {
  @property({ type: Number }) characterCount = 0;
  @property({ type: Number }) characterLimit = 0;
  @property({ type: String }) label = "";

  static styles = css`
    ${unsafeCSS(styles)}
  `;

  render() {
    if (this.characterCount > this.characterLimit) {
      return html`
        <dss-alert
          class="limit-alert"
          state="warning"
          size="md"
          message="${this.label} ${this.characterCount}/${this.characterLimit}"
          ></dss-alert>
      `;
    }
    return nothing;
  }
}
