package cn.ey.biz.module.weaver.api;

import cn.ey.biz.module.weaver.common.Constants;
import cn.ey.biz.module.weaver.common.RSP;
import cn.ey.biz.module.weaver.autoconfigure.FeignConfiguration;
import lombok.Data;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;

/**
 *流程实例：新建
 *
 */
@FeignClient(name= Constants.WEAVER_NAME, url="${weaver.service.url}", configuration = FeignConfiguration.class)
public interface DoCreateRequestService {

    @RequestMapping(method= RequestMethod.POST, value="/api/workflow/paService/doCreateRequest",
            consumes = MediaType.APPLICATION_FORM_URLENCODED_VALUE,
            produces = MediaType.TEXT_PLAIN_VALUE)
    RSP<DoCreateResponse> doCreateRequest(@RequestBody DoCreateRequest request);

    @Data
    class DoCreateRequest{
        String detailData;               //非必填	明细表数据，例子请看注意事项
        String mainData;                 //必填	    主表数据，request.setMainData("[{\"fieldName\":\"gsid\",\"fieldValue\":\"TS_2022_001\"}]");
        String otherParams;              //非必填	其他参数，比如messageType,isnextflow,requestSecLevel，delReqFlowFaild
        String remark;		             //非必填	签字意见，默认值流程默认意见若未设置则为空
        String requestLevel;             //非必填    紧急程度
        String requestName;              //必填      流程标题
        Integer workflowId;              //必填      流程Id
        String eysystemcode;             //code
        String eyredirecturl;            //回调url
    }

    @Data
    class DoCreateResponse{
        Integer requestid;
    }

}
