package thyyxxk.webserver.controller.outpatient.triage;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import thyyxxk.webserver.config.auth.PassToken;
import thyyxxk.webserver.entity.ResultVo;
import thyyxxk.webserver.entity.dictionary.CodeName;
import thyyxxk.webserver.entity.outpatient.triage.FloorScreenSetting;
import thyyxxk.webserver.entity.outpatient.triage.MzfzZdDeptRoom;
import thyyxxk.webserver.entity.outpatient.triage.RoomIp;
import thyyxxk.webserver.service.outpatient.triage.TriageSettingsService;
import thyyxxk.webserver.utils.ResultVoUtil;

import java.util.List;

@RestController
@RequestMapping("/triageSettings")
public class TriageSettingsController {
    private final TriageSettingsService service;

    @Autowired
    public TriageSettingsController(TriageSettingsService service) {
        this.service = service;
    }

    @GetMapping("/getAllMzDept")
    public ResultVo<List<CodeName>> getAllMzDept() {
        return service.getAllMzDept();
    }

    @GetMapping("/getChosenDept")
    public ResultVo<String[]> getChosenDept() {
        return service.getChosenDept();
    }

    @PostMapping("/saveChosenDept")
    public ResultVo<String> saveChosenDept(@RequestBody List<String> depts) {
        return service.saveChosenDept(depts);
    }

    @GetMapping("/getChosenRoom")
    public ResultVo<List<MzfzZdDeptRoom>> getChosenRoom() {
        return service.getChosenRoom();
    }

    @GetMapping("/searchDoctor")
    public ResultVo<List<CodeName>> searchDoctor(@RequestParam("content") String content) {
        return service.searchDoctor(content);
    }

    @GetMapping("/getReqs")
    public ResultVo<List<CodeName>> getReqs() {
        return service.getReqs();
    }

    @PostMapping("/updateRoomSettings")
    public ResultVo<String> updateRoomSettings(@RequestBody MzfzZdDeptRoom room) {
        return service.updateRoomSettings(room);
    }

    @GetMapping("/getAllRoomIp")
    public ResultVo<List<RoomIp>> getAllRoomIp() {
        return service.getAllRoomIp();
    }

    @PostMapping("/updateRoomIp")
    public ResultVo<String> updateRoomIp(@RequestBody RoomIp param) {
        return service.updateRoomIp(param);
    }

    @GetMapping("/getFloorScreenSetting")
    public ResultVo<FloorScreenSetting> getFloorScreenSetting(@RequestParam("userCode") String userCode) {
        return ResultVoUtil.success(service.getFloorScreenSetting(userCode));
    }
}
