package thyyxxk.webserver.controller.outpatient.interactive.complaints;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import thyyxxk.webserver.entity.ResultVo;
import thyyxxk.webserver.entity.outpatient.interactive.complaints.request.ComplaintsInquiry;
import thyyxxk.webserver.entity.outpatient.interactive.complaints.response.ComplaintsAndSuggestions;
import thyyxxk.webserver.service.outpatient.interactive.complaints.ComplaintsService;

import java.util.List;

@RestController
@RequestMapping("/complaints")
public class ComplaintsController {
    private final ComplaintsService service;

    @Autowired
    public ComplaintsController(ComplaintsService service) {
        this.service = service;
    }

    @PostMapping("/selectAllComplaints")
    public ResultVo<List<ComplaintsAndSuggestions>> selectAllComplaints(@RequestBody @Validated ComplaintsInquiry inquiry) {
        return service.selectAllComplaints(inquiry);
    }

    @PostMapping("/sendResponse")
    public ResultVo<String> sendResponse(@RequestBody ComplaintsAndSuggestions complaint) {
        return service.sendResponse(complaint);
    }
}
