import { Injectable } from '@angular/core';
import { BehaviorSubject } from 'rxjs';
import { BusinessListingCriteria, CommercialPropertyListingCriteria, UserListingCriteria } from '../../../../bizmatch-server/src/models/main.model';

@Injectable({
  providedIn: 'root',
})
export class SearchService {
  private criteriaSource = new BehaviorSubject<BusinessListingCriteria | CommercialPropertyListingCriteria | UserListingCriteria>(null);
  currentCriteria = this.criteriaSource.asObservable();

  constructor() {}

  search(criteria: BusinessListingCriteria | CommercialPropertyListingCriteria | UserListingCriteria): void {
    this.criteriaSource.next(criteria);
  }
}
