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