import { cleanObject } from '../../../../../utils/object';
import { RTETableExtensionAnnotationTypeEnum } from './table-annotation';
import { RTETableCellAnnotation } from './table-cell-annotation';
import { VegaInternalThemeManager } from '../../../../../helpers/theme/internal-theme-manager';
import { RTE_TABLE_HEAD_DEFAULT_BACKGROUND_COLOR } from '../constants/styles.constants';
/**
 * Class representing a table head cell annotation in the rich text editor.
 */
export class RTETableHeadCellAnnotation extends RTETableCellAnnotation {
  constructor(annotation = {}, useInternalStyle = true) {
    super(annotation, useInternalStyle);
  }
  /**
   * @inheritDoc
   */
  static from(cellAnnotation, useInternalStyle) {
    return [
      RTETableExtensionAnnotationTypeEnum.CELL,
      new RTETableHeadCellAnnotation(cellAnnotation, useInternalStyle),
    ];
  }
  /**
   * Gets the default background color for table head cells based on the current theme mode.
   *
   * @returns {string} The default background color for table head cells.
   */
  static getDefaultBackgroundColor() {
    return VegaInternalThemeManager.isDarkMode()
      ? RTE_TABLE_HEAD_DEFAULT_BACKGROUND_COLOR.dark
      : RTE_TABLE_HEAD_DEFAULT_BACKGROUND_COLOR.light;
  }
  /**
   * @inheritDoc
   */
  clone() {
    return new RTETableHeadCellAnnotation({
      backgroundColor: this.backgroundColor,
      padding: this.padding,
      border: this.border,
      width: this.width,
      height: this.height,
      textAlign: this.textAlign,
      verticalAlign: this.verticalAlign,
      minWidth: this.minWidth,
      boxSizing: this.boxSizing,
    }, this.useInternalStyle);
  }
  /**
   * @inheritDoc
   */
  renderStyle(options) {
    var _a;
    const styles = super.renderStyle(options);
    return cleanObject(Object.assign(Object.assign({}, styles), { backgroundColor: (_a = styles.backgroundColor) !== null && _a !== void 0 ? _a : RTETableHeadCellAnnotation.getDefaultBackgroundColor() }));
  }
}
