import { computed, inject } from '@angular/core';
import { toSignal } from '@angular/core/rxjs-interop';
import { ActivatedRoute } from '@angular/router';
import { RemissionListType } from '@isa/remission/data-access';

export const injectRemissionListType = () => {
  const route = inject(ActivatedRoute);
  const routeData = toSignal(route.data);
  return computed(() => {
    const data = routeData();
    if (!data) {
      return RemissionListType.Pflicht; // Default to Pflicht if no data is available
    }
    return data['remiType'] as RemissionListType;
  });
};
