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