package com.njcn.gather.storage.service;

import com.baomidou.mybatisplus.extension.service.IService;
import com.njcn.gather.storage.pojo.param.SingleNonHarmParam;
import com.njcn.gather.storage.pojo.param.StorageParam;
import com.njcn.gather.storage.pojo.po.ContrastHarmonicResult;
import com.njcn.gather.storage.pojo.po.SimAndDigBaseResult;
import com.njcn.gather.storage.pojo.po.SimAndDigHarmonicResult;
import com.njcn.gather.storage.pojo.vo.RawDataVO;
import com.njcn.gather.storage.pojo.vo.RawResultDataVO;

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

/**
 * @author caozehui
 * @data 2024-12-30
 */
public interface SimAndDigHarmonicService extends IService<SimAndDigHarmonicResult> {

    /**
     * 根据设备ID和通道号获取谐波结果
     *
     * @param scriptId 脚本id
     * @param deviceId 设备ID
     * @param chnNum   通道号，从1开始
     * @param code     计划code
     * @return 谐波结果
     */
    List<SimAndDigBaseResult> get(String scriptId, List<Integer> index, String deviceId, String chnNum, String code);

    /**
     * 查询原始数据
     *
     * @param param
     * @return
     */
    Map<String, List<RawDataVO>> listHarmData(StorageParam param);

    /**
     * 查询结果数据
     *
     * @param param
     * @return
     */
    Map<String, List<RawResultDataVO>> listHarmResultData(StorageParam param);

    /**
     * 获取索引
     *
     * @param param
     * @return
     */
    List<Integer> getIndex(StorageParam param);

    SimAndDigHarmonicResult getSingleResult(SingleNonHarmParam singleNonHarmParam);

    /**
     * 获取所有谐波结果数据
     *
     * @param scriptId
     * @param code
     * @param devId    设备ID
     * @return
     */
    List<SimAndDigHarmonicResult> listAllResultData(String scriptId, String code, String devId);

    /**
     * 获取所有原始数据
     *
     * @param scriptId
     * @param code
     * @param devId
     * @return
     */
    List<SimAndDigHarmonicResult> listAllRawData(String scriptId, String code, String devId);

    Map<String, Integer> maxSortByDevIds(String code, String scriptId, List<String> devIds);

    List<SimAndDigHarmonicResult> listByDevIdsAndSorts(String code, String scriptId, List<String> devIds, List<Integer> sorts);

    Map<String, List<Integer>> resultFlagsByDevIdsAndSorts(String code, String scriptId, List<String> devIds, List<Integer> sorts);
}
