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.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import java.util.List;

/**
 * 流程实例：获取流程信息（对外）
 *
 */
@FeignClient(name= Constants.WEAVER_NAME, url="${weaver.service.url}", configuration = FeignConfiguration.class)
public interface GetWorkflowRequestService {

    @RequestMapping(method= RequestMethod.GET, value="/api/workflow/paService/getWorkflowRequest",
            consumes = MediaType.APPLICATION_FORM_URLENCODED_VALUE,
            produces = MediaType.TEXT_PLAIN_VALUE)
    RSP<WorkflowResponse> getWorkflowRequest(@RequestParam("requestId")String requestId);

    @Data
    class WorkflowRequest{
        String  requestId;		  //必填	请求ID	""
    }

    @Data
    class WorkflowResponse{
        boolean canEdit;
        boolean canView;
        String  createTime;
        String  creatorId;
        String   creatorName;
        String  currentNodeId;
        String   currentNodeName;
        String   forwardButtonName;
        String lastOperateTime;
        String  lastOperatorName;
        String  messageType;
        boolean  mustInputRemark;
        boolean  needAffirmance;
        String rejectButtonName;
        String remark;
        String requestId;
        String requestLevel;
        String  requestName;
        String  status;
        String subbackButtonName;
        String submitButtonName ;
        String subnobackButtonName;
        workflowBaseInfoResponse workflowBaseInfo;   //流程信息
    //"workflowDetailTableInfos":[...]1 item
    //"workflowHtmlShow":[...]2 items
    //"workflowHtmlTemplete":[...]2 items
    //"workflowMainTableInfo":{...}2 items
       List<workflowRequestLogsResponse> workflowRequestLogs;       //流程意见
    }
    @Data
    class workflowBaseInfoResponse{
        String  workflowId;
        String  workflowName;
        String  workflowTypeId;
        String  workflowTypeName;
    }

    @Data
    class workflowRequestLogsResponse{
        String  annexDocHtmls;
        String  id;
        String  nodeId;
        String  nodeName;
        String  operateDate;
        String  operateTime;
        String  operateType;
        String  operatorDept;
        String  operatorId;
        String  operatorName;
        String  receivedPersons;
        String  remark;
        String  signDocHtmls;
        String  signWorkFlowHtmls;
    }

}
