import { AnnotationAction } from '../../../dto/actions/annotation-action.abstract';
/**
 * Action to apply annotations to a table cell.
 */
export class RTETableCellAnnotationsAction extends AnnotationAction {
  constructor(cellAnnotation, originAnnotation) {
    super();
    this.isFlushable = true;
    this.cellAnnotation = cellAnnotation;
    this.originAnnotation = originAnnotation;
  }
  /**
   * @inheritDoc
   */
  toAnnotation() {
    this.updateOriginAnnotation();
    return this.originAnnotation;
  }
  /**
   *
   * Update the origin annotation by cellAnnotation
   */
  updateOriginAnnotation() {
    Object.keys(this.cellAnnotation).forEach((key) => {
      this.originAnnotation[key] = this.cellAnnotation[key];
    });
  }
}
