package thyyxxk.webserver.controller.dictionary.wxservice;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import thyyxxk.webserver.entity.ResultVo;
import thyyxxk.webserver.entity.dictionary.CodeName;
import thyyxxk.webserver.entity.dictionary.wxservice.ZdHealthEducation;
import thyyxxk.webserver.entity.dictionary.wxservice.ZdHealthEducationType;
import thyyxxk.webserver.service.dictionary.wxservice.ServiceNumberService;

import java.util.List;
import java.util.Map;

/**
 * @ClassName HealthEducationController
 * @Author hsh
 * @Date 2024/3/22 8:51
 * @Version 1.0
 * @Description 服务号相关字典
 **/
@RestController
@RequestMapping("/serviceNumber")
public class ServiceNumberController {

    private final ServiceNumberService service;

    @Autowired
    public ServiceNumberController(ServiceNumberService service) {
        this.service = service;
    }

    @GetMapping("/selectServiceNumberDict")
    public ResultVo<Map<String, List<CodeName>>> selectServiceNumberDict(){
        return service.selectServiceNumberDict();
    }

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

    @PostMapping("/saveHealthEducation")
    public ResultVo<Map<String, Object>> saveHealthEducation(@RequestBody @Validated ZdHealthEducation zdHealthEducation){
        return service.saveHealthEducation(zdHealthEducation);
    }

    @GetMapping("/delHealthEducationByCode")
    public ResultVo<Map<String, Object>> delHealthEducationByCode(@RequestParam("code") String code){
        return service.delHealthEducationByCode(code);
    }

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

    @PostMapping("/saveHeType")
    public ResultVo<Map<String, Object>> saveHeType(@RequestBody @Validated ZdHealthEducationType zdHealthEducationType){
        return service.saveHeType(zdHealthEducationType);
    }

    @GetMapping("/delHeTypeByCode")
    public ResultVo<Map<String, Object>> delHeTypeByCode(@RequestParam("code") String code){
        return service.delHeTypeByCode(code);
    }

}
