import { Component } from '../component.js';

class Badge extends Component {
  constructor (data) {
    super(data, 'badge');
  }

  get ejsPath () {
    return 'src/dsfr/component/badge/template/ejs/badge.ejs';
  }

  async format () {
    const classes = ['fr-mb-6v'];
    classes.push(...(this.data.classes || []));
    return {
      markup: this.data.markup || 'span',
      size: this.data.size || 'sm',
      label: this.data.label ?? this.data.text,
      id: this.data.id,
      classes: classes,
      attributes: this.data.attributes,
      type: this.data.type || 'info',
      icon: this.data.icon,
    }
  }
}

export { Badge };
