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

import cn.ey.biz.module.weaver.autoconfigure.FeignConfiguration;
import cn.ey.biz.module.weaver.common.Constants;
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 CheckOperatorAndSharedService {

    @RequestMapping(method= RequestMethod.POST, value="/api/ey/workflow/checkOperatorAndShared",
            consumes = MediaType.APPLICATION_FORM_URLENCODED_VALUE,
            produces = MediaType.TEXT_PLAIN_VALUE)
    CheckOperatorAndSharedResponse checkOperatorAndShared(@RequestBody CheckOperatorAndSharedRequest request);

    @Data
    class CheckOperatorAndSharedRequest{
        String userid;
        String requestid;
    }

    @Data
    class CheckOperatorAndSharedResponse{
        String errMsg;
        Boolean api_status;
        String code;
        Boolean isOperator;
    }

}
