import { Injectable } from "@nestjs/common";
import { Observable, Subject } from "rxjs";
import { PayPeriodEvent } from "src/time-and-attendance/pay-period/dtos/pay-period-event.dto";

@Injectable()
export class PayPeriodEventService {
    private readonly pay_period_events$ = new Subject<PayPeriodEvent>();

    emit(event: PayPeriodEvent) {
        this.pay_period_events$.next(event);
    }

    stream(): Observable<PayPeriodEvent> {
        return this.pay_period_events$.asObservable();
    }
}