package com.cool.store.service.impl;

import com.cool.store.dao.BigRegionDAO;
import com.cool.store.dto.region.BigRegionDTO;
import com.cool.store.entity.BigRegionDO;
import com.cool.store.enums.ErrorCodeEnum;
import com.cool.store.exception.ServiceException;
import com.cool.store.request.QueryBigRegionRequest;
import com.cool.store.service.BigRegionService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.Collections;
import java.util.List;

/**
 * @Author suzhuhong
 * @Date 2025/5/9 14:28
 * @Version 1.0
 */
@Service
public class BigRegionServiceImpl implements BigRegionService {

    @Resource
    BigRegionDAO bigRegionDAO;

    @Override
    public List<BigRegionDTO> queryAllBigRegion(String keyword, Integer joinBrand){
        return bigRegionDAO.queryAllBigRegion(keyword, joinBrand);
    }

    @Override
    public BigRegionDO queryOrgInfoByBigRegionAndJoinMode(Long regionId, Integer joinMode){
        if (regionId==null||joinMode==null){
            throw  new ServiceException(ErrorCodeEnum.PARAMS_REQUIRED);
        }
        return bigRegionDAO.queryOrgInfoByBigRegionAndJoinMode(regionId,joinMode);
    }

    @Override
    public List<BigRegionDTO> queryBigRegion(QueryBigRegionRequest queryBigRegionRequest) {
        return bigRegionDAO.queryBigRegion(queryBigRegionRequest);
    }

}
