package data

import (
	"eta/eta_mobile/models/data_manage"
	"eta/eta_mobile/models/data_manage/excel"
)

type ChartInfoDataShow interface {
	GetEdbDataMapList(chartInfoId, chartType int, calendar, startDate, endDate string, mappingList []*data_manage.ChartEdbInfoMapping, seasonExtraConfig string) (edbDataListMap map[int][]*data_manage.EdbDataList, edbList []*data_manage.ChartEdbInfoMapping, err error)
	GetChartEdbMappingListByEdbInfoIdList(edbIdList []int) (mappingList []*data_manage.ChartEdbInfoMapping, err error)
}

type BaseChartInfoDataShow struct {
}

// GetEdbDataMapList 获取指标最后的基础数据
func (e *BaseChartInfoDataShow) GetEdbDataMapList(chartInfoId, chartType int, calendar, startDate, endDate string, mappingList []*data_manage.ChartEdbInfoMapping, seasonExtraConfig string) (edbDataListMap map[int][]*data_manage.EdbDataList, edbList []*data_manage.ChartEdbInfoMapping, err error) {
	// 指标对应的所有数据
	edbDataListMap, edbList, err = GetEdbDataMapList(chartInfoId, chartType, calendar, startDate, endDate, mappingList, seasonExtraConfig)
	return
}

// GetChartEdbMappingListByEdbInfoIdList 获取指标最后的基础数据
func (e *BaseChartInfoDataShow) GetChartEdbMappingListByEdbInfoIdList(edbIdList []int) (mappingList []*data_manage.ChartEdbInfoMapping, err error) {
	mappingList, err = data_manage.GetChartEdbMappingListByEdbInfoIdList(edbIdList)
	return
}

type ExcelChartInfoDataShow struct {
	DataListMap    map[int][]*data_manage.EdbDataList
	MappingListTmp []*excel.ExcelChartEdb
}

// GetEdbDataMapList 获取指标最后的基础数据
func (e *ExcelChartInfoDataShow) GetEdbDataMapList(chartInfoId, chartType int, calendar, startDate, endDate string, mappingList []*data_manage.ChartEdbInfoMapping, seasonExtraConfig string) (edbDataListMap map[int][]*data_manage.EdbDataList, edbList []*data_manage.ChartEdbInfoMapping, err error) {
	// 指标对应的所有数据
	edbDataListMap, edbList, err = GetBalanceExcelEdbDataMapList(chartInfoId, chartType, calendar, startDate, endDate, mappingList, seasonExtraConfig, e.DataListMap)
	return
}

// GetChartEdbMappingListByEdbInfoIdList 获取指标最后的基础数据
func (e *ExcelChartInfoDataShow) GetChartEdbMappingListByEdbInfoIdList(edbIdList []int) (mappingList []*data_manage.ChartEdbInfoMapping, err error) {
	// 指标对应的所有数据
	mappingList, err = TransferChartEdbToEdbMappingFormat(0, 0, e.MappingListTmp, e.DataListMap)
	return
}
