import { getParagraphList, getShortBookInfo, getShortBookInfoAppListOfPage, readingShort, startReadShort } from '@src/server/book/short'
import { bookrackShrot } from '@src/server/bookrack'
import { getShortBanners, getShortHotCategory, getShortHotBooks, getShortNewBooks, getShortHotRec, getShortBestReviews, getShortClassicBooks, getShortBestBooks, getShortGuessLike } from '@src/server/index/index'
/**用于长短篇小说区别,使用不同的接口
 * 传入appInfoStroe
*/
function useApi() {
    //判断是长篇
    let isLong = app?.appInfo?.appCategory === 1
    return {
        /**获取小说列表*/
        getBookPageList: isLong ? getShortBookInfoAppListOfPage : getShortBookInfoAppListOfPage,
        /**获取小说内容*/
        getBookContent: isLong ? getParagraphList : getParagraphList,
        /**获取小说详情用于分享进入*/
        getBookInfo: isLong ? getShortBookInfo : getShortBookInfo,
        /**小说阅读上报*/
        startReadBook: isLong ? startReadShort : startReadShort,
        /**小说阅读心跳上报*/
        readingBook: isLong ? readingShort : readingShort,
        /**书架*/
        bookrackList: isLong ? bookrackShrot : bookrackShrot,
        /**首页组件接口*/
        indexComponents: {
            "banners": isLong ? getShortBanners : getShortBanners,
            "hot_books": isLong ? getShortHotBooks : getShortHotBooks,//热门标签
            "hot_category": isLong ? getShortHotCategory : getShortHotCategory,//热门书籍
            "new_books": isLong ? getShortNewBooks : getShortNewBooks,//重磅新书
            "hot_rec": isLong ? getShortHotRec : getShortHotRec,//热门推荐
            "best_reviews": isLong ? getShortBestReviews : getShortBestReviews,//口碑
            "classic_books": isLong ? getShortClassicBooks : getShortClassicBooks,//经典
            "best_books": isLong ? getShortBestBooks : getShortBestBooks,//必看
            "guess_like": isLong ? getShortGuessLike : getShortGuessLike,//猜喜欢
        }
    }

}
export default useApi
