package com.fs.live.service;


import com.fs.common.core.domain.R;
import com.fs.live.domain.LiveWatchUser;
import com.fs.live.vo.LiveWatchUserVO;
import com.fs.store.domain.FsUser;

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

/**
 * 直播间观看用户Service接口
 *
 * @author fs
 * @date 2025-01-18
 */
public interface ILiveWatchUserService {
    /**
     * 查询直播间观看用户
     *
     * @param id 直播间观看用户主键
     * @return 直播间观看用户
     */
    LiveWatchUser selectLiveWatchUserById(Long id);

    /**
     * 查询企业直播间观看用户
     * @param id                直播间用户ID
     * @param companyId         企业ID
     * @param companyUserId     企业用户ID
     * @return LiveWatchUser
     */
    LiveWatchUser selectLiveWatchUserByIdAndCompanyIdAndCompanyUserId(Long id, Long companyId, Long companyUserId);

    /**
     * 查询直播间观看用户列表
     *
     * @param liveWatchUser 直播间观看用户
     * @return 直播间观看用户集合
     */
    List<LiveWatchUser> selectLiveWatchUserList(LiveWatchUser liveWatchUser);

    /**
     * 新增直播间观看用户
     *
     * @param liveWatchUser 直播间观看用户
     * @return 结果
     */
    int insertLiveWatchUser(LiveWatchUser liveWatchUser);

    /**
     * 修改直播间观看用户
     *
     * @param liveWatchUser 直播间观看用户
     * @return 结果
     */
    int updateLiveWatchUser(LiveWatchUser liveWatchUser);

    /**
     * 批量删除直播间观看用户
     *
     * @param ids 需要删除的直播间观看用户主键集合
     * @return 结果
     */
    int deleteLiveWatchUserByIds(Long[] ids);

    /**
     * 删除直播间观看用户信息
     *
     * @param id 直播间观看用户主键
     * @return 结果
     */
    int deleteLiveWatchUserById(Long id);

    List<LiveWatchUser> getByLiveIdAndUserId(long liveId, long userId);

    Map<String, Integer> getLiveFlagWithCache(Long liveId);
    LiveWatchUser join(FsUser fsUser, long liveId, long userId, String location);
    LiveWatchUser close(long liveId, long userId);

    /**
     * 查询直播间在线用户列表
     * @param params 参数
     * @return list
     */
    List<LiveWatchUserVO> selectWatchUserList(Map<String, Object> params);

    /**
     * 修改直播间用户禁言状态
     * @param liveId    直播间ID
     * @param userId    用户ID
     * @return  受影响条数
     */
    int changeUserState(Long liveId, Long userId);

    /**
     * 根据直播间ID和用户ID查询观看用户信息
     * @param liveId    直播间ID
     * @param userId    观看用户ID
     * @return LiveWatchUserVO
     */
    LiveWatchUserVO selectWatchUserByLiveIdAndUserId(Long liveId, Long userId);

    List<LiveWatchUserVO> selectOnlineUserList(LiveWatchUser param);

    List<LiveWatchUser> checkOnlineNoRewardUser(Long liveId, Date now);

    int blockUser(Long userId);


    List<LiveWatchUser> selectLiveWatchAndRegisterUser(Long liveId, Long lotteryId);


    List<LiveWatchUserVO> asyncToCache(Long liveId);

    R liveUserTotals(LiveWatchUser liveWatchUser);
}
