import { NodeAnnotation, NodeAnnotationTypeEnum } from './node-annotation.abstract';
import { BOLD_FONT_WEIGHT } from './text-format-default-styles';
/**
 * Annotation to make text bold
 */
export class BoldAnnotation extends NodeAnnotation {
  constructor(bold) {
    super();
    this.type = NodeAnnotationTypeEnum.BOLD;
    this.bold = bold;
  }
  /**
   * Generate the map item for the annotation
   *
   * @param {boolean} bold - Bold annotation
   * @returns {[NodeAnnotationTypeEnum.BOLD, BoldAnnotation]} Map item for the annotation
   */
  static from(bold) {
    return [NodeAnnotationTypeEnum.BOLD, new BoldAnnotation(bold)];
  }
  /**
   * Generate the JSON representation of the annotation
   *
   * @returns {Record<string, unknown>} JSON representation of the annotation
   */
  toJSON() {
    return {
      bold: this.bold,
    };
  }
  /**
   * @inheritDoc
   */
  clone() {
    return new BoldAnnotation(this.bold);
  }
  /**
   * @inheritDoc
   */
  renderClass(options) {
    if (options === null || options === void 0 ? void 0 : options.standalone)
      return null;
    return this.bold ? 'v-rte--bold' : null;
  }
  /**
   * @inheritDoc
   */
  renderStyle(options) {
    if (!(options === null || options === void 0 ? void 0 : options.standalone))
      return null;
    return this.bold ? { fontWeight: BOLD_FONT_WEIGHT } : null;
  }
}
