package com.yeejoin.amos.boot.module.jg.biz.controller;

import com.yeejoin.amos.boot.module.jg.biz.service.IBizDataChangeHandleStrategy;
import com.yeejoin.amos.boot.module.jg.biz.service.impl.BizDataChangeServiceImpl;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.typroject.tyboot.core.restful.utils.ResponseHelper;
import org.typroject.tyboot.core.restful.utils.ResponseModel;

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

@RestController
@RequestMapping(value = "/data-change")
@Api(tags = "业务数据变化处理控制器")
public class BizDataChangeController {


    private BizDataChangeServiceImpl bizDataChangeService;

    public BizDataChangeController(BizDataChangeServiceImpl bizDataChangeService) {
        this.bizDataChangeService = bizDataChangeService;
    }

    @PostMapping(value = "/{bizType}/save")
    @ApiOperation(value = "业务数据变更保存", httpMethod = "GET")
    public ResponseModel<String> save(String applyNo,
                                      @PathVariable String bizType,
                                      IBizDataChangeHandleStrategy.ModelType model,
                                      Map<String, List<Map<String, Object>>> changeData) {
        bizDataChangeService.save(applyNo,bizType, model, changeData);
        return ResponseHelper.buildResponse("success");
    }



}
