using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Text;
using Domain;
using CommonEntity;

namespace Service
{
    public interface IHostManager : IGenericManager<Host>
    {
        IList<HostMappingData> LoadAllID_HostNumberMapping();
        IList<HostRoomNumberMapping> LoadAll_RoomNumberMapping();
        IList<Host> LoadAll(string order, string sort, Group group, string roomNumber);

        IList<Host> LoadAll(Group group);

        IList<Host> LoadAll(string hotelCode);

        IList<Host> LoadAll(int hotelID, string roomNumber = "");

        IList<Host> LoadAll(IList<Group> groupList, RoomStatus roomStatus, RoomType roomType);

        IList<Host> LoadAllByPage(out long total, int page, int rows, string order, string sort, int groupId, int hotelID, string roomNumber, string mac, string roomType, int isSyncRoomNumber);

        DataTable LoadHostWithPage(out long total, int page, int rows, string order, string sort, int groupId, int hotelID, string roomNumber, string mac, string roomType);

        /// <summary>
        /// 
        /// </summary>
        /// <param name="total"></param>
        /// <param name="page"></param>
        /// <param name="rows"></param>
        /// <param name="group">楼层</param>
        /// <param name="lang">语言：0/中文，1/英文</param>
        /// <returns></returns>
        IList<Room> LoadRooms(out long total, int page, int rows, int? groupId, int lang, int hotelID);

        IList<Host> GetByGroup(Group group);

        IList<string> LoadRoomNumbers();

        DataTable LoadRoomNumbers(Group group, int hotelID);

        Host GetByMAC(string mac, int hotelID);
        /// <summary>
        /// 通过mac地址获取主机列表（只限C系列主机）
        /// </summary>
        /// <param name="mac"></param>
        /// <returns></returns>
        IList<Host> LoadByMac(string mac);

        Host GetByXiaoDuCUID(string cuid);

        Host GetByTianMaoCUID(string cuid);

        Host GetByTCLCUID(string cuid);

        Host GetByHuaWeiCUID(string cuid);

        Host GetByHiWeiCUID(string cuid);

        Host GetByRoomNumberSupply(string roomNumber);
        /// <summary>
        /// 返回指定房号的主机
        /// </summary>
        /// <param name="roomNumber"></param>
        /// <returns></returns>
        Host GetByRoomNumber(string roomNumber, int hotelID);

        Host GetByRoomNumber(int roomid, int hotelID);

        Host GetByRoomNumber(string roomNumber, string hotelCode);

        /// <summary>
        /// 返回与指定 host 连通的 Host，结果中不包含指定的host。
        /// </summary>
        /// <param name="host"></param>
        /// <returns></returns>
        //IList<Host> GetConnectRoomHosts(Host host);

        /// <summary>
        /// 返回指 HostID 的房号
        /// </summary>
        /// <param name="hostID"></param>
        /// <returns></returns>
        string GetRoomNumber(int hostID);

        /// <summary>
        /// 升级RCU主机
        /// </summary>
        /// <param name="hostUpdate">升级包</param>
        /// <param name="hosts">RCU主机</param>
        void UpdateHost(HostUpdate hostUpdate, FileType fileType, string fileHref, string fileMd5, IList<Host> hosts, bool isTFTP);
        /// <summary>
        /// 针对C主机升级
        /// </summary>
        /// <param name="hostUpdate">升级包</param>
        /// <param name="hosts">RCU主机</param>
        void UpdateHostC(HostUpdate hostUpdate, FileType fileType, string fileHref, string fileMd5, IList<Host> hosts);

        /// <summary>
        /// 更改房态
        /// </summary>
        /// <param name="host"></param>
        /// <param name="roomStatus"></param>
        void ChangeRoomStatus(Host host, RoomStatus roomStatus, string wxValidate = "");
        /// <summary>
        /// 更改房态
        /// </summary>
        /// <param name="host"></param>
        /// <param name="roomStatusID">2：出租，4：待租，8：退房，16：空房</param>
        void ChangeRoomStatus(Host host, int roomStatusID, string wxValidate = "");

        /// <summary>
        /// 批量更改主机网络设置
        /// </summary>
        /// <param name="hostList">RCU主机列表</param>
        /// <param name="ip">IP地址</param>
        /// <param name="subnetmask">子网掩码</param>
        /// <param name="gateway">默认网关</param>
        /// <param name="port">通讯端口</param>
        void ChangeNetworkSetting(IList<Host> hostList, string ip, string subnetmask, string gateway, ushort port);

        /// <summary>
        /// 设置或取消连通房
        /// </summary>
        /// <param name="hosts">主机列表</param>
        /// <param name="cancel">false/设置连通房，true/取消连通房，默认false</param>
        //void ConnectRoom(IList<Host> hosts, bool cancel = false);

        /// <summary>
        /// 主机授权
        /// </summary>
        /// <param name="hostList"></param>
        /// <param name="expires"></param>
        void AccreditForHost(IList<Host> hostList, DateTime expires);

        /// <summary>
        /// 下发设备密钥
        /// </summary>
        /// <param name="host"></param>
        void SetDeviceSecret(Host host);

        /// <summary>
        /// 获取主机密钥
        /// </summary>
        /// <param name="host"></param>
        void SendForGetHostSecret(Host host);

        /// <summary>
        /// 同步主机信息
        /// </summary>
        /// <param name="host"></param>
        void SyncHostInfo(Host host);
        /// <summary>
        /// 下发主机信息
        /// </summary>
        /// <param name="host"></param>
        void PublishHostInfo(Host host);
        /// <summary>
        /// 下发主机信息
        /// </summary>
        /// <param name="host"></param>
        /// <param name="sendData">指定地址和设置内容</param>
        void PublishHostInfo(Host host, byte[] sendData);
        /// <summary>
        /// 保存智能语音绑定信息
        /// </summary>
        /// <param name="host"></param>
        void SaveSmartVoiceBinding(Host host);

        /// <summary>
        /// 透传
        /// </summary>
        /// <param name="hostnumber"></param>
        /// <param name="mac"></param>
        /// <param name="bbb"></param>
        void PublishUDPData(string hostnumber,string mac,byte[] data,byte cmdtype,bool isoriginal=false);
        /// <summary>
        /// 根据房型获取主机列表（C主机升级使用）
        /// </summary>
        /// <param name="hotelID"></param>
        /// <param name="roomTypeID"></param>
        /// <returns></returns>
        IList<Object> LoadHostByRoomType(int hotelID, int roomTypeID);


        IList<Object> LoadHostByRoomTypeChengZiHao(int hotelID, int roomTypeID, string roomNumber);
        /// <summary>
        /// 根据房型获取所有主机列表
        /// </summary>
        /// <param name="hotelID"></param>
        /// <param name="roomTypeID"></param>
        /// <returns></returns>
        IList<Object> LoadAllHostByRoomType(int hotelID, int roomTypeID);

        /// <summary>
        /// 凌晨定时
        /// </summary>
        /// <param name="hotelcode"></param>
        /// <param name="sheng_jiang_value"></param>
        void TimerECO(string hotelcode, int sheng_jiang_value);
        /// <summary>
        /// 阿宝添加的
        /// 获取所有任务的信息
        /// </summary>
        List<KongTiaoTimer> GetInitializeKTMission();

        /// <summary>
        /// 空调定时控制
        /// </summary>
        void AirConditionTimer_Controller(int hotel_id, string HotelCode,string HotelCreateDate,int host_id, string RoomNo,KongTiaoTimer k);


        void LoggerTest();

        List<ECO_Setting> Get_ECOList();
        void ECO_Execute(string hotelid);
        void Zero_Refresh();



        //tftp

        void Send_Query_Data(byte[] data, string host_number, string mac);
        void Send_Setting_Data(byte[] data, string host_number, string mac);
    }
}
 