<?php  namespace App\Services\Orders\Discounts;  use App\Models\Discount; use App\Contracts\DiscountServiceInterface;  class DiscountServiceFactory { 	/** 	 * @return AboveSetPriceDiscountService|ClubPointsDiscountService|CouponCodeDiscountService|GeneralDiscountService|SameProductMultipleTimesDiscountService|null 	 */ 	public static function make(int $type): DiscountServiceInterface|GiftCodeDiscountService|null 	{ 		switch ($type) { 			case Discount::GENERAL_DISCOUNT: return new GeneralDiscountService(new GeneralDiscountReturnObject, new DiscountAmountCalculator);  			case Discount::COUPON_CODE_DISCOUNT: return new CouponCodeDiscountService(new DiscountReturnObject, new DiscountAmountCalculator);  			case Discount::CLUB_POINTS_DISCOUNT: return new ClubPointsDiscountService(new DiscountReturnObject, new DiscountAmountCalculator, getUser()->user ?? null);  			case Discount::SAME_PRODUCT_MULTIPLE_TIMES_DISCOUNT: return new SameProductMultipleTimesDiscountService(new DiscountReturnObject, new DiscountAmountCalculator, setting('free_product_quantity'));  			case Discount::ABOVE_SET_PRICE_DISCOUNT: return new AboveSetPriceDiscountService(new DiscountReturnObject, new DiscountAmountCalculator, setting('order_final_amount_discount_limit'));  			case Discount::GIFT_CODE_DISCOUNT: return new GiftCodeDiscountService(new DiscountReturnObject, new DiscountAmountCalculator); 		}  		return null; 	} }