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

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import thyyxxk.webserver.entity.ResultVo;
import thyyxxk.webserver.entity.outpatient.interactive.comments.request.CommentInquiry;
import thyyxxk.webserver.entity.outpatient.interactive.comments.response.CommentsResponse;
import thyyxxk.webserver.service.outpatient.interactive.comments.CommentsService;

@RestController
@RequestMapping("/comments")
public class CommentsController {
    private final CommentsService service;

    @Autowired
    public CommentsController(CommentsService service) {
        this.service = service;
    }

    @PostMapping("/getComments")
    public ResultVo<CommentsResponse> getComments(@RequestBody CommentInquiry inquiry) {
        return service.getComments(inquiry);
    }

    @GetMapping("/updateCommentStatus")
    public ResultVo<String> updateCommentStatus(@RequestParam("id") int id,
                                                @RequestParam("deleted") int deleted) {
        return service.updateCommentStatus(id, deleted);
    }
}
