package com.jpsoft.shinestar.modules.base.service;

import com.github.pagehelper.Page;
import com.jpsoft.shinestar.modules.base.entity.DeviceInfo;
import com.jpsoft.shinestar.modules.base.entity.PersonDeviceRelation;
import com.jpsoft.shinestar.modules.common.dto.Sort;
import com.jpsoft.shinestar.modules.pacs.dto.IsPersonExistVo;

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

public interface PersonDeviceRelationService {
	PersonDeviceRelation get(String id);
	boolean exist(String id);
	int insert(PersonDeviceRelation model);
	int update(PersonDeviceRelation model);
	int updateDevicePerson(PersonDeviceRelation model) throws Exception;
	int delete(String id);
	List<PersonDeviceRelation> list();
	List<PersonDeviceRelation> findByPersonId(Long personId);
	List<PersonDeviceRelation> findByDeviceId(String deviceId);
	List<Long> findByDerviceName(String derviceName);
	PersonDeviceRelation findByDeviceIdAndPersonId(String deviceId, Long personId);
	Page<PersonDeviceRelation> pageSearch(Map<String, Object> searchParams, int pageNum, int pageSize, boolean count, List<Sort> sortList);

    List<DeviceInfo> findDeviceByPersonId(Long id);

	List<PersonDeviceRelation> findByIsBoundAndUpdateTime(Date updateTime, Integer limit);

	void updateIsBound(Long personInfoId, String deviceInfoId, Boolean isBound);

	void updateListIsBound(List<IsPersonExistVo> list, String deviceInfoId);


    //List<PersonDeviceRelation> findByPersonId(Long id);

	/**
	 * 绑定新设备
	 * @param deviceId
	 * @return
	 */
	int bindNewDevice(String deviceId);
}