/*
 * Copyright (C) 2023 Robert Bosch GmbH Copyright (C) 2023 Robert Bosch Manufacturing Solutions GmbH, Germany. All rights reserved.
 */
import { Directive, HostListener, EventEmitter, Output } from '@angular/core';

@Directive({
  selector: '[bciDirtyFlag]',
  standalone: true
})

/**
 * This directive emits an output flag when the value of the input
 * where the directive its used is changed
 */
export class BciDirtyFlagDirective {
  @Output() isDirty: EventEmitter<boolean> = new EventEmitter<boolean>(false);

  @HostListener('input', ['$event.target.value'])
  onInput(): void {
    this.isDirty.emit(true);
  }
}
