import { CommonModule } from '@angular/common';
import { ChangeDetectionStrategy, Component, Input, ViewEncapsulation } from '@angular/core';
import { ThemeComponentsVariants } from '../../models/theme-variant.model';
import { Utils } from '../../utils/utils.util';
import { BulletSize } from './bullet.model';

@Component({
  selector: 'nj-bullet',
  templateUrl: './bullet.component.html',
  changeDetection: ChangeDetectionStrategy.OnPush,
  encapsulation: ViewEncapsulation.None,
  standalone: true,
  imports: [CommonModule]
})
export class BulletComponent {
  private bulletClassName = 'nj-bullet';

  /**
   * Bullet variant
   */
  @Input() variant: ThemeComponentsVariants = 'brand';

  /**
   * Bullet custom color, overrides variant
   */
  @Input() customColor: string;

  /**
   * Bullet size
   */
  @Input() size: BulletSize = 'md';

  constructor() {}

  /**
   * @ignore
   */
  getBulletVariantClass(): string {
    if (!this.variant || !Utils.isUndefinedOrNull(this.customColor)) {
      return '';
    }
    return `${this.bulletClassName}--${this.variant}`;
  }

  /**
   * @ignore
   */
  getButtonSizeClass(): string {
    if (!this.size) {
      return '';
    }
    return `${this.bulletClassName}--${this.size}`;
  }
}
