package kr.co.accura.wtm.api;

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

import java.util.List;

@RestController
@RequestMapping("/api/wtm/work-rules")
@RequiredArgsConstructor
public class WorkRuleController {

    private final WorkRuleService workRuleService;

    @GetMapping
    public List<WorkRuleDto> list() {
        return workRuleService.getAll();
    }

    @PutMapping
    public List<WorkRuleDto> update(@RequestBody List<WorkRuleDto> dtos) {
        return workRuleService.saveAll(dtos);
    }
}
