import { NodeAnnotation, NodeAnnotationTypeEnum } from './node-annotation.abstract';
/**
 * Annotation to make text a link
 */
export class LinkAnnotation extends NodeAnnotation {
  constructor(link, useInternalStyle = true) {
    super();
    this.type = NodeAnnotationTypeEnum.LINK;
    this.link = link;
    this.useInternalStyle = useInternalStyle;
  }
  /**
   * Generate the map item for the annotation
   *
   * @param {VegaRTELink} link - Bold annotation
   * @param {boolean} useInternalStyle - Whether to use default style for the link
   * @returns {[NodeAnnotationTypeEnum.LINK, LinkAnnotation]} Map item for the annotation
   */
  static from(link, useInternalStyle = true) {
    return [NodeAnnotationTypeEnum.LINK, new LinkAnnotation(link, useInternalStyle)];
  }
  /**
   * Generate the JSON representation of the annotation
   *
   * @returns {Record<'link', VegaRTELink>} JSON representation of the annotation
   */
  toJSON() {
    return {
      link: this.link,
    };
  }
  /**
   * @inheritDoc
   */
  clone() {
    return new LinkAnnotation(this.link, this.useInternalStyle);
  }
  /**
   * Verify whether two link annotation is same or not
   *
   * @param {LinkAnnotation} annotation - Compared annotation
   * @returns {boolean} Whether two link annotation is same or not
   */
  toEqual(annotation) {
    return this.link.groupKey === annotation.link.groupKey;
  }
  /**
   * @inheritDoc
   */
  renderClass() {
    return null;
  }
  /**
   * @inheritDoc
   */
  renderStyle() {
    return null;
  }
}
