/*
 * Copyright (c) 2021 LG Electronics Inc.
 * SPDX-License-Identifier: AGPL-3.0-only 
 */

package oss.fosslight.repository;

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

import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import oss.fosslight.domain.OssMaster;
import oss.fosslight.domain.Vulnerability;

@Mapper
public interface VulnerabilityMapper {

	int selectVulnerabilityTotalCount(Vulnerability vulnerability);
	
	List<Vulnerability> selectVulnerabilityList(Vulnerability vulnerability);
	
	int checkVulnDataCnt(Vulnerability vulnerability);
	
	List<String> selectVulnerabilityOSSNameAutoComplete();

	List<String> selectVulnerabilityOSSVersionAutoComplete(String name);

	List<String> selectVulnerabilityCveIdAutoComplete();
	
	int getVulnListByOssNameCnt(OssMaster bean);
	
	List<Vulnerability> getVulnListByOssName(OssMaster bean);

	int updateOssRecheckVulnFlag();

	int selectNvdTotalCount();

	List<Map<String, Object>> selectVendorProductInfo(OssMaster ossBean);
	
	List<Map<String, Object>> selectNvdInfo(OssMaster ossBean);
	
	List<Map<String, Object>> selectNvdInfo2(OssMaster ossBean);
	
	void insertNvdOssHis(OssMaster ossBean);

	void updateOssVulnInfoNew(OssMaster newNVD);

	List<String> selectUsedVulnerabilityOssProject(OssMaster ossBean);
	
	Map<String, Object> selectNvdInfoWithOutVer(OssMaster ossBean);

	void deleteOssVulnInfo(String ossId);
	
	List<Vulnerability> selectVulnerabilityExportList(Vulnerability vulnerability);

	Map<String, Object> getCveInfo(String cveId);

	List<Map<String, Object>> selectMaxScoreNvdInfo(Map<String, Object> paramMap);

	List<String> getPatchLinkForNvdData(@Param("cveId") String cveId);

	List<Vulnerability> getSecurityVulnListByOssName(OssMaster bean);

	List<Map<String, Object>> getCpeInfoAndRange(@Param("cveId") String cveId, @Param("ossName") String ossName);

	List<Map<String, Object>> selectDiffVendorForProduct(OssMaster ossBean);
	
	List<Map<String, Object>> selectDiffVendorForVendorProduct(OssMaster ossBean);

	int checkDiscoveredSndMailCnt(OssMaster ossBean);

	void insertOssDiscoveredSndEmail(Map<String, Object> paramMap);

	void updateOssDiscoveredSndEmail();

	List<Map<String, Object>> selectDiscoveredSndMailList(OssMaster ossBean);

	int selectDiscoveredNotSndMailList(OssMaster ossBean);

	Vulnerability selectNotFixedCveInfo(OssMaster ossBean);

	List<Map<String, Object>> selectVendorProductSndMailList(OssMaster ossBean);

	List<Map<String, Object>> selectNvdInfoSndMailList(OssMaster ossBean);

	List<Map<String, Object>> selectVendorProductInfoWithOurVer(OssMaster ossBean);

	int getCpeMatchForCpeInfoCnt(Map<String, Object> paramMap);
}