package com.kym.service.factory;

import com.kym.entity.Activity;
import com.kym.service.DiscountService;
import com.kym.service.OrderWashDayService;
import com.kym.service.impl.NoDiscountHandle;
import com.kym.service.impl.WashDayDiscountHandle;
import org.springframework.stereotype.Component;

/**
 * 优惠策略工厂
 *
 * @author skyline
 */
@Component
public class DiscountStrategyFactory {

    private static OrderWashDayService orderWashDayService;

    public DiscountStrategyFactory(OrderWashDayService orderWashDayService) {
        DiscountStrategyFactory.orderWashDayService = orderWashDayService;
    }

    public static DiscountService getDiscountStrategy(String discountType) {
        if (Activity.DISCOUNT_TYPE_洗车日.equals(discountType)) {
            return new WashDayDiscountHandle(orderWashDayService);
        } else {
            return new NoDiscountHandle();
        }
    }
}
