package com.dowstats.controllers

import com.dowstats.data.dto.controllers.WeaponDto
import com.dowstats.data.dto.controllers.building.BuildingFullDto
import com.dowstats.data.dto.controllers.building.RaceBuildings
import com.dowstats.data.repositories.BuildingRepository
import com.dowstats.service.datamaps.DowBuildingMappingService
import com.dowstats.service.datamaps.WeaponService
import org.springframework.beans.factory.annotation.Autowired
import org.springframework.web.bind.annotation.DeleteMapping
import org.springframework.web.bind.annotation.GetMapping
import org.springframework.web.bind.annotation.PathVariable
import org.springframework.web.bind.annotation.RequestMapping
import org.springframework.web.bind.annotation.RestController


@RestController
@RequestMapping("api/v1/weapon")
class WeaponController @Autowired constructor(
    val weaponService: WeaponService,
    val buildingRepository: BuildingRepository,
) {



    @GetMapping("/{modId}/{weaponId}")
    fun getById(@PathVariable weaponId: Long, @PathVariable modId: Long): WeaponDto {
        return weaponService.getWeaponDto(weaponId, modId)
    }

    @DeleteMapping
    fun removeAll() {
        buildingRepository.deleteAll()
    }
}