package com.prolog.rdc.tms.service.strategy;

import com.prolog.product.core.framework.entity.UserEntity;
import com.prolog.rdc.tms.model.dto.ShipBillPriceDTO;
import com.prolog.rdc.tms.model.entity.BmsFreightPriceModel;
import com.prolog.rdc.tms.model.entity.BmsLogisticsContractModel;
import com.prolog.rdc.tms.model.entity.BmsShipBillHeaderModel;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class ExecuteStrategyServiceImpl implements ExecuteStrategyService {

    @Autowired
    private CostStrategyRuleHandlerContext context;

    @Override
    public List<ShipBillPriceDTO> executeStrategy(BmsLogisticsContractModel contractModel, BmsFreightPriceModel priceModel, Integer settlementModel, BmsShipBillHeaderModel costStrategy, String source, UserEntity user) {
        AbstractSplitStrategyRuleHandler handlerInstance = this.context.getHandlerInstance(settlementModel);
        return handlerInstance.executeStrategy(contractModel,priceModel,costStrategy, source,user);
    }
}
