package thyyxxk.webserver.controller.dictionary;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import thyyxxk.webserver.entity.ResultVo;
import thyyxxk.webserver.entity.dictionary.CodeName;
import thyyxxk.webserver.entity.dictionary.medicaltechnology.MedicalTechnologyItem;
import thyyxxk.webserver.entity.dictionary.medicaltechnology.QueryRequest;
import thyyxxk.webserver.service.dictionary.MedicalTechnologyService;
import thyyxxk.webserver.utils.ResultVoUtil;

import java.util.List;

@RestController
@RequestMapping("/medicalTechnologyCatalog")
public class MedicalTechnologyController {
    private final MedicalTechnologyService service;

    @Autowired
    public MedicalTechnologyController(MedicalTechnologyService service) {
        this.service = service;
    }

    @GetMapping("/getDeptSelections")
    ResultVo<List<CodeName>> getDeptSelections() {
        return ResultVoUtil.success(service.getDeptSelections());
    }

    @PostMapping("/queryQualifiedItems")
    public ResultVo<List<MedicalTechnologyItem>> queryQualifiedItems(@RequestBody QueryRequest request) {
        return ResultVoUtil.success(service.queryQualifiedItems(request));
    }

    @PostMapping("/saveTechnologyCatalogue")
    public ResultVo<String> saveTechnologyCatalogue(@RequestBody MedicalTechnologyItem body) {
        return ResultVoUtil.success(service.saveTechnologyCatalogue(body));
    }

    @PostMapping("/updateDelFlag")
    public ResultVo<String> updateDelFlag(@RequestBody MedicalTechnologyItem body) {
        return ResultVoUtil.success(service.updateDelFlag(body));
    }
}
