package kr.co.accura.wtm.api;

import kr.co.accura.wtm.domain.config.dto.OverheadTypeDto;
import kr.co.accura.wtm.domain.config.service.OverheadTypeService;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@RequestMapping("/api/wtm/overhead-types")
@RequiredArgsConstructor
public class OverheadTypeController {

    private final OverheadTypeService overheadTypeService;

    @GetMapping
    public List<OverheadTypeDto> list() {
        return overheadTypeService.getAll();
    }

    @PostMapping
    public OverheadTypeDto create(@RequestBody OverheadTypeDto dto) {
        return overheadTypeService.create(dto);
    }

    @PutMapping("/{id}")
    public OverheadTypeDto update(@PathVariable Long id, @RequestBody OverheadTypeDto dto) {
        return overheadTypeService.update(id, dto);
    }
}
