package com.fjhx.sale.flow;

import com.alibaba.fastjson.JSONObject;
import com.fjhx.flow.core.FlowDelegate;
import com.fjhx.flow.enums.FlowStatusEnum;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

/**
 * 样品单变更流程
 */
@Component
public class SampleUpdateFlow extends FlowDelegate {
    private final ContractUpdateFlow contractUpdateFlow;

    @Autowired
    public SampleUpdateFlow(ContractUpdateFlow contractUpdateFlow) {
        this.contractUpdateFlow = contractUpdateFlow;
    }

    @Override
    public String getFlowKey() {
        return "sample_update_flow";
    }

    /**
     * 发起流程
     */
    @Override
    public Long start(Long flowId, JSONObject submitData) {
        return contractUpdateFlow.start(flowId, submitData);
    }

    /**
     * 结束流程
     */
    @Override
    public void end(Long flowId, Long businessId, JSONObject submitData) {
        contractUpdateFlow.end(flowId, businessId, submitData);
    }


    /**
     * 驳回
     */
    @Override
    public void reject(Long flowId, Long businessId, FlowStatusEnum flowStatus) {
        contractUpdateFlow.reject(flowId, businessId, flowStatus);
    }

    /**
     * 重新发起
     */
    @Override
    public void relaunch(Long flowId, Long businessId, FlowStatusEnum flowStatus, JSONObject submitData) {
        contractUpdateFlow.relaunch(flowId, businessId, flowStatus, submitData);
    }

    /**
     * 作废
     */
    @Override
    public void cancellation(Long flowId, Long businessId, FlowStatusEnum flowStatus) {
        contractUpdateFlow.cancellation(flowId, businessId, flowStatus);
    }
}
