import { BaseAction } from './base-action';
import { Observable, of } from 'rxjs';
import { IActionResult } from '../interfaces/actions/action-result';

export class DialogCallbackAction extends BaseAction {
  callback?: (action: DialogCallbackAction) => void;

  constructor(init: Partial<DialogCallbackAction>) {
    super(init);
    this.refreshAfterExecute = false;
  }

  executeImpl(): Observable<IActionResult> {
    if (this.callback) {
      this.callback(this);
    }

    return of(null);
  }
}
