package cn.freemud.demo.service.impl;

import cn.freemud.base.entity.BaseResponse;
import cn.freemud.demo.entities.bo.goods.ResponseBuilder;
import cn.freemud.demo.entities.bo.goods.add.BaseAddGoodsBO;
import cn.freemud.demo.service.impl.AbstractAddGoodsService;
import cn.freemud.enums.ResponseResult;
import cn.freemud.interceptor.ServiceException;
import cn.freemud.utils.ResponseUtil;
import org.springframework.stereotype.Service;

@Service
public class MCoffeeAddGoodsService extends AbstractAddGoodsService {

    private static Integer MAX_SHOP_LENGTH = 64;

    @Override
    public BaseResponse checkCustomParams(BaseAddGoodsBO baseRequestDTO) {
        if (baseRequestDTO.getShopId().length() > MAX_SHOP_LENGTH){
            return ResponseUtil.error(ResponseResult.SHOPPING_CART_SHOP_ID_NOT_EMPTY);
//            throw new ServiceException(ResponseResult.SHOPPING_CART_SHOP_ID_NOT_EMPTY);
        }

        return ResponseBuilder.success();
    }

}
