package space.nstart.pcp.pcp_request_service.controller

import org.springframework.beans.factory.annotation.Autowired
import org.springframework.web.bind.annotation.PostMapping
import org.springframework.web.bind.annotation.RequestBody
import org.springframework.web.bind.annotation.RequestMapping
import org.springframework.web.bind.annotation.RestController
import space.nstart.pcp.pcp_request_service.service.TLEService
import space.nstart.pcp.pcp_types_lib.dto.ballistics.TLEDTO
import space.nstart.pcp.pcp_types_lib.dto.ballistics.TlePointRequestDTO
import space.nstart.pcp.pcp_types_lib.dto.ballistics.TleRevolutionsRequestDTO
import space.nstart.pcp.pcp_types_lib.dto.ballistics.TleRvaRequestDTO

@RestController
@RequestMapping("/api/tle")
class TLEController {

    @Autowired
    private lateinit var tleService: TLEService


    @PostMapping("/parse")
    fun orbit(@RequestBody tle : TLEDTO) = tleService.parseTLE(tle)

    @PostMapping("/point")
    fun point(@RequestBody req: TlePointRequestDTO) = tleService.point(req)


    @PostMapping("/rva")
    fun rva(@RequestBody req : TleRvaRequestDTO) = tleService.rva(req)

    @PostMapping("/revolutions")
    fun revolutions(@RequestBody req: TleRevolutionsRequestDTO) = tleService.revolutions(req)

}
