package com.dowstats.service.datamaps

import com.dowstats.data.dto.controllers.WeaponDto
import com.dowstats.data.repositories.WeaponRepository
import org.springframework.beans.factory.annotation.Autowired
import org.springframework.stereotype.Service

@Service
class WeaponService @Autowired constructor(
    val weaponRepository: WeaponRepository,
    val requirementsMappingComponent: RequirementsMappingComponent,
) {

    fun getWeaponDto(id: Long, modId: Long): WeaponDto {
        val weapon = weaponRepository.findById(id).get()
        val requirements = requirementsMappingComponent
            .getRequirements(weapon.weaponRequirements.toList(),
                modId)
        return weapon.toDto(requirements)
    }



}