package com.pcloud.book.group.service;

import java.util.List;
import java.util.Map;


import com.pcloud.book.group.dto.PersonalQrcodeDTO;
import com.pcloud.book.group.dto.GroupCipherDTO;
import com.pcloud.book.group.dto.GroupUseDTO;
import com.pcloud.book.group.dto.ResourceBrowseParamDto;

import org.springframework.cloud.netflix.feign.FeignClient;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;
import com.pcloud.book.group.dto.BookGroupDTO;
import com.pcloud.common.dto.ResponseDto;
import com.pcloud.common.dto.StoreFlowInfoDto;
import com.pcloud.common.exceptions.BizException;
import com.pcloud.common.page.PageBeanNew;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;

/**
 * Description 社群书内部接口
 * Created by PENG on 2019/5/14.
 */
@FeignClient(value = "pcloud-service-book", qualifier = "bookGroupServiceCloud", path = "book/v1.0/bookGroupService")
@Api(description = "社群书内部接口")
public interface BookGroupService {

    @ApiOperation("获取社群书基本信息")
    @RequestMapping(value = "getBookGroupInfo",method = RequestMethod.GET)
    ResponseEntity<ResponseDto<BookGroupDTO>> getBookGroupInfo(@RequestParam("bookGroupId")Long bookGroupId) throws BizException;

    @ApiOperation("批量获取社群书基本信息")
    @RequestMapping(value = "getBookGroupInfoByIds", method = RequestMethod.POST)
    ResponseEntity<ResponseDto<Map<Long, BookGroupDTO>>> getBookGroupInfoByIds(@RequestBody List<Long> bookGroupIds) throws BizException;

    @ApiOperation("为信息流批量获取社群书基本信息")
    @RequestMapping(value = "getFlowInfoByBookGroupIds", method = RequestMethod.POST)
    ResponseEntity<ResponseDto<Map<Long, StoreFlowInfoDto>>> getFlowInfoByBookGroupIds(@RequestBody List<Long> bookGroupIds) throws BizException;

    @ApiOperation("获取指定条数社群书基本信息")
    @RequestMapping(value = "getBookGroupInfoByChannelId",method = RequestMethod.GET)
    ResponseEntity<ResponseDto<Map<Long, StoreFlowInfoDto>>> getBookGroupInfoByChannelId(@RequestParam("channelId")Long channelId, @RequestParam("itemNum")Integer itemNum) throws BizException;

    @ApiOperation(value = "知识商城获取社群书信息")
    @RequestMapping(value = "listBookGroup4KnowledgeMall",method = RequestMethod.GET)
    ResponseEntity<ResponseDto<PageBeanNew<StoreFlowInfoDto>>> listBookGroup4KnowledgeMall(@RequestParam(value="channelId",required = false)Long channelId,
                                                                                       @RequestParam("currentPage")int currentPage,
                                                                                       @RequestParam("numPerPage") int numPerPage) throws BizException;

    @ApiOperation("获取社群书基本信息")
    @RequestMapping(value = "getBaseInfoBySceneId",method = RequestMethod.GET)
    ResponseEntity<ResponseDto<BookGroupDTO>> getBaseInfoBySceneId(@RequestParam("sceneId")Long sceneId) throws BizException;


    @ApiOperation("更新个人二维码")
    @RequestMapping(value = "updatePersonQrcode",method = RequestMethod.POST)
    void updatePersonQrcode(@RequestBody PersonalQrcodeDTO personalQrcodeDTO) throws BizException;

    @ApiOperation("获取暗号状态")
    @GetMapping("/getCipherState")
    ResponseEntity<ResponseDto<Integer>> getCipherState(@RequestParam("cipher")String cipher) throws BizException;

    @ApiOperation("更新暗号状态为已使用")
    @GetMapping("/updateCipherStateToUsed")
    void updateCipherStateToUsed(@RequestParam("cipher")String cipher, @RequestParam("wxId")String wxId) throws BizException;

    @ApiOperation("获取个人二维码方式群已使用和未使用数量")
    @PostMapping("/getGroupUse")
    ResponseEntity<ResponseDto<GroupUseDTO>> getGroupUse(@RequestBody List<String> altIds) throws BizException;

    @ApiOperation("获取暗号基本信息")
    @GetMapping("/getJoinGroupCipher")
    ResponseEntity<ResponseDto<GroupCipherDTO>> getJoinGroupCipher(@RequestParam("cipher")String cipher) throws BizException;

    @ApiOperation("获取资源浏览数据")
    @PostMapping("getResourcesBrowseCount")
    ResponseEntity<ResponseDto<Map<Long, Long>>> getResourcesBrowseCount(@RequestBody ResourceBrowseParamDto resourceBrowseParamDto);


}
