import { Blocker } from './Blocker';

/**
 * SubmitBlocker prevents multiple submissions until explicitly released.
 *
 * Useful for preventing duplicate form submissions or API calls.
 */
export class SubmitBlocker extends Blocker {
  private blocked = false;

  canExecute(): boolean {
    return !this.blocked;
  }

  block(): void {
    this.blocked = true;
  }

  release(): void {
    this.blocked = false;
  }
}