import { InformativRapportCategory } from '@msfa-enums/informativ-rapport-category.enum';
import { InformativRapportResponse } from './api/informativ-rapport.response.model';

export interface InformativRapport {
  genomforandeReferens: number;
  category: InformativRapportCategory;
  comment: string;
  motivation?: string;
  status?: string;
}

export function mapResponseToInformativRapport(data: InformativRapportResponse): InformativRapport {
  const { genomforandeReferens, category, comment } = data.content;

  return {
    genomforandeReferens,
    category: InformativRapportCategory[category] as InformativRapportCategory,
    comment: comment,
    motivation: data.motivation,
    status: data.status,
  };
}
