/*
 * Copyright (c) 2018-2999 广州亚米信息科技有限公司 All rights reserved.
 *
 * https://www.gz-yami.com/
 *
 * 未经允许，不可做商业用途！
 *
 * 版权所有，侵权必究！
 */

package com.yami.shop.service;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.IService;
import com.yami.shop.bean.app.dto.ShopHeadInfoDto;
import com.yami.shop.bean.model.ShopAuditing;
import com.yami.shop.bean.model.ShopDetail;
import com.yami.shop.bean.param.ShopDetailParam;
import com.yami.shop.bean.param.OfflineHandleEventAuditParam;
import com.yami.shop.common.util.PageParam;
import org.apache.ibatis.annotations.Param;
import org.springframework.http.ResponseEntity;

import java.util.List;

/**
 * @author lgh on 2018/08/29.
 */
public interface ShopDetailService extends IService<ShopDetail> {

    void updateShopDetail(ShopDetail shopDetail, ShopDetail dbShopDetail);

    void deleteShopDetailByShopId(Long id);

    /**
     * 根据店铺id获取店铺信息
     *
     * @param shopId
     * @return
     */
    ShopDetail getShopDetailByShopId(Long shopId);

    void removeShopDetailCacheByShopId(Long shopId);

    /**
     * 根据店铺的手机号（登陆账号），获取店铺信息
     *
     * @param mobile 手机号
     * @return
     */
    ShopDetail getShopByMobile(@Param("mobile") String mobile);

    void updatePasswordByUserName(String username, String newPassword);

    /**
     * 根据用户id查询店铺信息
     */
    ShopDetail getShopDetailByUserId(String userId);

    /**
     * 申请开店铺
     */
    void applyShop(String userId, ShopDetailParam shopDetailParam);

    /**
     * 审核商家信息
     */
    boolean audit(ShopAuditing shopAuditing);

    /**
     * 平台 --下线活动商品
     */
    void offline(ShopDetail shopDetail, String offlineReason, Long sysUserId);

    /**
     * 申请审核
     */
    void auditApply(Long eventId, Long handleId, String reapplyReason);

    /**
     * 审核下线商店
     */
    void auditOfflineShop(OfflineHandleEventAuditParam offlineHandleEventAuditParam, Long sysUserId);

    /**
     * 热门店铺
     *
     * @return
     */
    List<ShopHeadInfoDto> listHotShopsHead();

    /**
     * 分页搜索店铺
     *
     * @param page
     * @param shopHeadInfoDto
     * @return
     */
    Page<ShopHeadInfoDto> searchShops(PageParam<ShopHeadInfoDto> page, ShopHeadInfoDto shopHeadInfoDto);

    void insertDetail(ShopDetail shopDetail);

    int checkMobile(String mobile, Long shopId);

    void updatePasswordOrMobile(Long shopId, String password, String mobile);

    ResponseEntity<ShopHeadInfoDto> neighborShop(String lat, String lon);

    ResponseEntity<ShopHeadInfoDto> neighborShop(String lat, String lon, Long channelId);
    ResponseEntity<List<ShopHeadInfoDto>> neighborShopList(String lat, String lon, Long channelId);

    ResponseEntity<List<ShopHeadInfoDto>> neighborShopByAddr(Long addr, Long channelId);
}
