package com.yuchen.saas.park.service.controller.basic;

import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
import com.yuchen.saas.park.api.dto.park.PmgBatPersonSysconfigDto;
import com.yuchen.saas.park.api.vo.park.PmgBatPersonSysconfigAndSwitchDataVo;
import com.yuchen.saas.park.api.vo.park.PmgBatPersonSysconfigAndSwitchVo;
import com.yuchen.saas.park.api.vo.park.PmgBatPersonSysconfigVo;
import com.yuchen.saas.park.service.service.IPmgBatPersonSysconfigService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.nest.springwrap.core.tool.api.R;
import org.springframework.web.bind.annotation.*;

import javax.validation.Valid;
import java.util.List;

/**
 * <p>
 * 人员中心+ -人员登记-设置 前端控制器
 * </p>
 *
 * @author baichaojie
 * @since 2024-11-05
 */
@Slf4j
@RestController
@RequiredArgsConstructor
@Api(value = "人员中心+ -人员登记-设置", tags = "人员中心+ -人员登记-设置")
@RequestMapping("/pmgBatPersonSysconfig")
public class PmgBatPersonSysconfigController {

    private final IPmgBatPersonSysconfigService baseService;


//    /**
//     * 根据param_code获取对应的参数
//     * @param paramCode
//     * @return
//     */
//    @GetMapping("/getValueByKey/{paramCode}")
//    @ApiOperationSupport(order = 1)
//    @ApiOperation(value = "人员中心+ -人员登记-设置 根据key获取值", notes = "人员中心+ -人员登记-设置 根据key获取值")
//    public R<PmgBatPersonSysconfigVo> getValueByKey(@PathVariable("paramCode") String paramCode) {
//        return baseService.getValueByKey(paramCode);
//    }


    /**
     * 人员中心+ -人员登记-设置 获取值人员同步的参数
     * @param
     * @return
     */
    @GetMapping("/getPersonSync/{parkId}")
    @ApiOperationSupport(order = 3)
    @ApiOperation(value = "人员中心+ -人员登记-设置 获取值人员同步的参数", notes = "人员中心+ -人员登记-设置 获取值人员同步的参数")
    public R<PmgBatPersonSysconfigAndSwitchVo> getPersonSync(@PathVariable("parkId") Long parkId) {
        return baseService.getPersonSync(parkId);
    }


    @PostMapping("/savePersonSync")
    @ApiOperationSupport(order = 3)
    @ApiOperation(value = "人员中心+ -人员登记-设置 保存人员同步的设置", notes = "人员中心+ -人员登记-设置 保存人员同步的设置")
    public R savePersonSync(@Valid @RequestBody  PmgBatPersonSysconfigAndSwitchDataVo pmgBatPersonSysconfigAndSwitchDataVo) {
        return R.data(baseService.savePersonSync(pmgBatPersonSysconfigAndSwitchDataVo.getData()));
    }


    /**
     * 根据param_code保存对应的param_value
     * @param pmgBatPersonSysconfigDto
     * @return
     */
    @PostMapping("/saveValueByKey")
    @ApiOperationSupport(order = 2)
    @ApiOperation(value = "人员中心+ -人员登记-设置 根据key保存值", notes = "人员中心+ -人员登记-设置 根据key保存值")
    public R saveValueByKey(@Valid PmgBatPersonSysconfigDto pmgBatPersonSysconfigDto) {
        return R.data(baseService.saveValueByKey(pmgBatPersonSysconfigDto));
    }


}
