package com.iformall.service.kw;


import com.github.pagehelper.PageInfo;
import com.iformall.common.ResultData;
import com.iformall.domain.po.KwBox;
import com.iformall.domain.po.KwMeter;
import com.iformall.domain.po.KwMeterData;


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

public interface KwBoxService {

    final static String PREFIX_CMD           = "CMD";
    final static String CMD_REGISTER         = "regist";
    final static String CMD_LOGIN            = "login";
    final static String CMD_HEARTBEAT        = "hb";

    final static String PREFIX_IMEI          = "IMEI";
    final static String PREFIX_ICCID         = "CCID";
    final static String PREFIX_TIME          = "TIME";
    final static String PREFIX_HW_VERSION    = "HWV";
    final static String PREFIX_FW_VERSION    = "FWV";
    final static String PREFIX_COM_KEY       = "comKey";
    final static String PREFIX_SYS_STATUS    = "sysStatus";
    final static String PREFIX_CONFIG        = "config";
    final static String PREFIX_METERS        = "meters";

    final static String METER_ADDRESS        = "addr";
    final static String METER_ACTIVE_POWER   = "ap";


    /**
     * 根据实体查询分页列表
     *
     * @param record
     * @param pageIndex
     * @param pageSize
     * @return
     */
    PageInfo<KwBox> listAsPage(KwBox record, Integer pageIndex, Integer pageSize);


    /**
     * 根据Id获得实体
     *
     * @param id
     * @return
     */
    KwBox getById(Long id);

    /**
     * 保存或更新实体
     *
     * @param record
     */
    void saveOrUpdate(KwBox record);


    /**
     * 根据Id删除实体
     *
     * @param id
     */
    void deleteById(Long id);


    /**
     * 根据实体查询分页列表
     *
     * @param record
     * @return
     */
    List<KwBox> findList(KwBox record);

    List<String> findMetersAddress(KwBox record);
    List<KwMeter> findMeters(KwBox record);

    KwBox findByImei(String imei);

    void saveMeterData(KwBox record, List<Map<String,String>> metersData, Date deviceTime);

}