import { Injectable } from '@angular/core';
import { FranvaroReportRequest } from '@msfa-models/api/franvaro-request.model';
import { DeltagareAvrop } from '@msfa-models/avrop.model';
import { FranvaroReason } from '@msfa-models/franvaro-reason.model';
import { DeltagareApiService } from '@msfa-services/api/deltagare.api.service';
import { FranvaroReportApiService } from '@msfa-services/api/franvaro-report.api.service';
import { Observable } from 'rxjs';

@Injectable()
export class FranvaroReportFormService {
  public reasons$: Observable<FranvaroReason[]> = this.franvaroReportApiService.fetchReasons$();
  public otherKnownReasons$: Observable<FranvaroReason[]> = this.franvaroReportApiService.fetchOtherKnownReasons$();

  constructor(
    private franvaroReportApiService: FranvaroReportApiService,
    private deltagareApiService: DeltagareApiService
  ) {}

  public fetchAvropInformation$(genomforandeReferens: number): Observable<DeltagareAvrop> {
    return this.deltagareApiService.fetchAvropInformation$(genomforandeReferens);
  }

  public postFranvaroReport$(requestData: FranvaroReportRequest): Observable<void> {
    return this.franvaroReportApiService.postFranvaroReport$(requestData);
  }
}
