package com.jy.flow.adapter;


import com.jy.flow.vo.WarmFlowInteractiveTypeVo;
import com.jy.framework.satoken.LoginContext;
import com.warm.flow.core.enums.CooperateType;
import org.springframework.stereotype.Component;

import java.util.Objects;

/**
 * 减签适配器
 */
@Component
public class ReductionSignatureAdapter extends AbstractWarmFlowAdapter implements WarmFlowAdapter {

    @Override
    public boolean isAdapter(Integer warmFlowType) {
        return Objects.equals(CooperateType.REDUCTION_SIGNATURE.getKey(), warmFlowType);
    }

    @Override
    public boolean adapter(WarmFlowInteractiveTypeVo obj) {
        return super.taskService.depute(
                obj.getTaskId(),
                LoginContext.getUserId().toString(),
                permissionList(),
                obj.getAddHandlers(),
                this.type(obj.getOperatorType())
        );
    }

}
