package com.trade.client;

import com.trade.client.enterprise.customer.service.EnterpriseService;
import com.trade.client.trade.purchasecontract.service.PurchaseContractService;
import com.trade.common.utils.SpringUtils;
import com.trade.service.contract.constant.ContractConstant;
import com.trade.service.contract.util.esign.bizprocess.BizProcessorFactory;
import com.trade.service.contract.util.esign.bizprocess.SignedBizProcessor;
import com.trade.service.credit.service.impl.BizEntityCreditAuthServiceImpl;
import org.springframework.stereotype.Component;

/**
 * 电子签章回调业务处理器工厂类
 */
@Component
public class DefaultBizProcessorFactory extends BizProcessorFactory {

    @Override
    public SignedBizProcessor getProcessor(String bizType) {
        switch (bizType) {
            case ContractConstant.SIGN_BIZ_TYPE_COMPANY_AUTH_CREDIT:
                return SpringUtils.getBean(BizEntityCreditAuthServiceImpl.class);
            case ContractConstant.SIGN_BIZ_TYPE_AUTHORIZATION_LETTER:
            case ContractConstant.SIGN_BIZ_TYPE_TAX_REBATE_AGREEMENT:
                return SpringUtils.getBean(EnterpriseService.class);
            case ContractConstant.SIGN_BIZ_TYPE_PURCHASE_CONTRACT:
                return SpringUtils.getBean(PurchaseContractService.class);
            // 其他业务类型
            default:
                return null;
        }
    }
}
