/*
 *      Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
 *
 *  Redistribution and use in source and binary forms, with or without
 *  modification, are permitted provided that the following conditions are met:
 *
 *  Redistributions of source code must retain the above copyright notice,
 *  this list of conditions and the following disclaimer.
 *  Redistributions in binary form must reproduce the above copyright
 *  notice, this list of conditions and the following disclaimer in the
 *  documentation and/or other materials provided with the distribution.
 *  Neither the name of the dreamlu.net developer nor the names of its
 *  contributors may be used to endorse or promote products derived from
 *  this software without specific prior written permission.
 *  Author: Chill 庄骞 (smallchill@163.com)
 */
package org.springblade.device.service;

import com.alibaba.fastjson.JSONObject;
import org.springblade.core.tool.api.R;
import org.springblade.device.entity.GbDeviceChannel;
import org.springblade.device.vo.GbDeviceChannelTreeVO;
import org.springblade.device.vo.GbDeviceChannelVO;
import org.springblade.core.mp.base.BaseService;
import com.baomidou.mybatisplus.core.metadata.IPage;
import org.springblade.system.vo.DeptVO;

import java.util.List;

/**
 *  服务类
 *
 * @author BladeX
 * @since 2021-12-06
 */
public interface IGbDeviceChannelService extends BaseService<GbDeviceChannel> {

	/**
	 * 自定义分页
	 *
	 * @param page
	 * @param gbDeviceChannel
	 * @return
	 */
	IPage<GbDeviceChannelVO> selectGbDeviceChannelPage(IPage<GbDeviceChannelVO> page, GbDeviceChannelVO gbDeviceChannel);

	R submitBatch(List<GbDeviceChannel> gbDeviceChannelList);

	GbDeviceChannel getByChannelId(String deviceId, String channelId);

	R<JSONObject> play(String deviceId, String channelId);

	R<String> stop(String deviceId, String channelId);

	List<GbDeviceChannel> selectByDeviceIds(List<String> deviceIdList);

	/**
	 * 懒加载树形结构
	 *
	 * @param parentColumn
	 * @param parentId
	 * @return
	 */
	List<GbDeviceChannelTreeVO> lazyTree(String parentColumn, Long parentId);

	List<GbDeviceChannel> listByAgencyId(Long agencyId);

	List<GbDeviceChannel> listByResidentialId(Long agencyId, Long residentialId);

	List<GbDeviceChannel> listByBuildingId(Long agencyId, Long residentialId, Long buildingId);

	List<GbDeviceChannel> listByFloorId(Long agencyId, Long residentialId, Long buildingId, Long floorId);

	/**
	 * 点位绑定
	 * @param deviceId
	 * @param channelId
	 * @param residentialId
	 * @param buildingId
	 * @param floorId
	 * @return
	 */
	R bind(String deviceId, String channelId, Long residentialId, Long buildingId, Long floorId, String installAddress);

	R deleteChannel(String deviceId, String tenantId);

}
