import {
  FREE_DELIVERY_THRESHOLD_SEK,
  STANDARD_DELIVERY_FEE_SEK,
} from '@/domain/constants/commerce';

/**
 * DOMAIN SERVICE — Delivery pricing rules (single source of truth)
 */
export class DeliveryFeeService {
  static calculateDeliveryFee(subtotal: number): number {
    return subtotal > FREE_DELIVERY_THRESHOLD_SEK ? 0 : STANDARD_DELIVERY_FEE_SEK;
  }

  static calculateGrandTotal(subtotal: number): number {
    return subtotal + DeliveryFeeService.calculateDeliveryFee(subtotal);
  }

  static isFreeDelivery(subtotal: number): boolean {
    return subtotal > FREE_DELIVERY_THRESHOLD_SEK;
  }
}