package com.dowstats.service.datamaps

import com.dowstats.data.dto.controllers.research.ResearchDto
import com.dowstats.data.repositories.ResearchRepository
import org.springframework.beans.factory.annotation.Autowired
import org.springframework.stereotype.Service

@Service
class ResearchService @Autowired constructor(
    val researchRepository: ResearchRepository,
    val requirementsMappingComponent: RequirementsMappingComponent,
) {

    fun getResearchDto(id: Long, modId: Long): ResearchDto {
        val research = researchRepository.findById(id).get()
        val requirements = requirementsMappingComponent
            .getRequirements(research.researchRequirements.toList() ,
                modId)
        return research.toResearchDto(requirements)
    }



}