package com.zksy.base.service;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.IService;
import com.zksy.base.domain.HazardHiddenAccount;
import com.zksy.base.dto.HazardPageInDTO;

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

public interface HazardHiddenAccountService extends IService<HazardHiddenAccount> {

    Page<HazardHiddenAccount> findByPage(HazardPageInDTO dto);

    boolean saveWithCheck(HazardHiddenAccount entity);

    boolean updateWithCheck(HazardHiddenAccount entity);

    /**
     * 隐患报送（同时自动创建工单）
     * @return 创建的工单ID，若无需创建返回null
     */
    Long submitHazard(String hazardId);

    List<HazardHiddenAccount> getActiveMapPoints();

    List<Map<String, Object>> statisticsByType(String startDate, String endDate);

    List<Map<String, Object>> statisticsByStatus(String startDate, String endDate);

    Map<String, Object> statisticsOverview(String startDate, String endDate);

    List<Map<String, Object>> statisticsByLevel(String startDate, String endDate);

    List<Map<String, Object>> statisticsByRegion(String startDate, String endDate);

    /**
     * 隐患类型时间线统计（按天汇总，每条类型一条折线）
     * 返回: { categories: [日期...], series: [{ name: 类型, data: [数量...] }] }
     */
    Map<String, Object> statisticsTypeTimeline(String startDate, String endDate);

    /**
     * 整改状态时间线统计（按天汇总，每个状态一组柱）
     * 返回: { categories: [日期...], series: [{ name: 状态, data: [数量...] }] }
     */
    Map<String, Object> statisticsStatusTimeline(String startDate, String endDate);
}
