package com.fs.watch.service;

import com.fs.common.core.domain.R;
import com.fs.his.domain.FsHealthTongue;
import com.fs.watch.domain.WatchFsUser;
import com.fs.watch.domain.WatchUser;
import com.fs.watch.domain.vo.AppFsUserVo;
import com.fs.watch.domain.vo.WatchInfoVo;
import com.fs.watch.domain.vo.WatchUserAndHealthVo;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageRequest;

import java.util.List;

/**
 * 用户腕表配置表(WatchUser)表服务接口
 *
 * @author makejava
 * @since 2024-10-17 17:11:12
 */
public interface WatchUserService {


    /**
     * 通过设备id查询WatchFsUser
     * @param deviceId
     * @return
     */
    WatchFsUser selectWatchFsUserByDeviceIdAndUserId(String deviceId,Long userId,Integer type);

    /**
     * 通过设备id查询WatchFsUser
     * @param deviceId
     * @return
     */
    List<WatchFsUser> selectWatchFsUserByDeviceId(String deviceId);

    /**
     * 通过设备id查询AppFsUserVo
     * @param deviceId
     * @return
     */
    AppFsUserVo getUserInfoByDeviceId(String deviceId,Boolean isFamily,Long watchUserId);

    /**
     * 通过ID查询单条数据
     *
     * @param userId 主键
     * @return 实例对象
     */
    WatchFsUser selectWatchFsUserById(Long userId);

    /**
     * 分页查询
     *
     * @param watchUser 筛选条件
     * @param pageRequest      分页对象
     * @return 查询结果
     */
    Page<WatchUser> queryByPage(WatchUser watchUser, PageRequest pageRequest);

    /**
     * 新增数据
     *
     * @param watchUser 实例对象
     * @return 实例对象
     */
    int insert(WatchUser watchUser);

    /**
     * 修改腕表用户
     *
     * @param watchUser 腕表用户
     * @return 结果
     */
    public int updateWatchUser(WatchUser watchUser);

    R editDevice(String userId, String imei, String model, String ble, String version);

    Boolean removeDevice(String userId, String deviceId);

    /**
     * 通过主键删除数据
     *
     * @param userId 主键
     * @return 是否成功
     */
    boolean deleteById(Long userId);


    int updateFsUserByDeviceId(WatchFsUser user);

    List<WatchInfoVo> getWatchInfo(long userId);

    List<WatchUserAndHealthVo> listByDeviceIdNotNull();

    FsHealthTongue getLastTongueByDeviceId(String deviceId);
}
