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