package com.jeesharp.business.modules.mall.service;

import com.jeesharp.business.modules.mall.entity.MallFreightTemplate;
import com.jeesharp.business.modules.mall.vo.MallFreightTemplateQueryVO;
import com.jeesharp.framework.mybatis.core.service.BaseInterface;

import java.math.BigDecimal;
import java.util.List;

/**
 * 运费模板 Service 接口
 */
public interface MallFreightTemplateService extends BaseInterface<MallFreightTemplate, MallFreightTemplateQueryVO> {

    void createTemplate(MallFreightTemplate entity);

    void updateTemplate(MallFreightTemplate entity);
List<MallFreightTemplate> getEnabledTemplates();

    BigDecimal calculateFreight(String templateId, String province, String city,
                                BigDecimal totalWeight, Integer totalQuantity, BigDecimal orderAmount);

    /**
     * 计算运费（支持省市区编码匹配 {@code mall_freight_template_region}）。
     */
    BigDecimal calculateFreight(String templateId,
                                 String provinceCode, String cityCode, String districtCode,
                                 String province, String city, String district,
                                 BigDecimal totalWeight, Integer totalQuantity, BigDecimal orderAmount);

    MallFreightTemplate getDefaultTemplate();
}
