'use strict';
import { resourceNames } from '../../../fd-toolbox/resources/resource-names.js';
import { getODataBuilder } from '../../../fd-toolbox/odata/odata-builder-funcs.js';
import { reportProps } from '../../common/demo/props/report-props.js';
import { tryGetResourceById } from '../../meta/server/services/resource-provider.js';
import { getUserId } from '../../meta/server/auth/users/current-user-id-provider.js';
import { reportIds } from './report-mother.js';
import { reportData11, reportData10, reportData9, reportData8, reportData7, reportData6, reportData5, reportData4, reportData3, reportData2, reportData1 } from '../dashboards/dashboard-report-data-master-data.js';
import { getResourcesByName } from '../../meta/server/db/db.js';
import { dealProps } from '../../common/demo/props/deal-props.js';
import { calculateTotalPropertyValue } from '../../../fd-toolbox/property/calculate-total-property-value.js';
import { isNullOrUndefined } from '../../../fd-toolbox/functions/value-checking-functions.js';
import { getResourceMeta } from '../../meta/server/services/metas.js';

var __defProp=Object['defineProperty'],__name=(_0x2ec50f,_0x75f102)=>__defProp(_0x2ec50f,'name',{'value':_0x75f102,'configurable':!![]});async function getOne(_0x57483d){const _0x1708e4=await getUserId(),_0x448a79=getODataBuilder(),_0x529fc9=_0x448a79['expand'](reportProps['reportChartSeriesList'])['build']();let _0x4b8017=await tryGetResourceById(resourceNames['report'],_0x57483d,_0x1708e4,![],_0x529fc9);if(!isNullOrUndefined(_0x4b8017))return getDashboardReportData(_0x57483d,_0x4b8017);return void(0x1fa1+0xcf4+-0x2c95);}__name(getOne,'getOne');async function createBigDigitReport(_0x2feb86,_0x19e21d,_0x306578){const _0x11ccd7=await getResourcesByName(_0x19e21d),_0x19c063=calculateTotalPropertyValue(_0x11ccd7,_0x306578);return {'id':_0x2feb86['id'],'report':_0x2feb86,'data':['$'+_0x19c063]};}__name(createBigDigitReport,'createBigDigitReport');async function getDealDashboard(){const _0x38e706=await getResourcesByName(resourceNames['deal']),_0x418d35=await getResourceMeta(resourceNames['deal']),_0x5d7b3c=_0x418d35['properties'][dealProps['stage']],_0x51f8e0=new Map(),_0x239a42=_0x5d7b3c['enumerationValues']??[],_0x4fb0af=_0x5d7b3c['enumerationDisplayName']??[];for(let _0xb9e66f=-0x342*-0x1+0x1931+-0x1c73;_0xb9e66f<_0x239a42['length'];_0xb9e66f++){_0x51f8e0['set'](_0x239a42[_0xb9e66f],_0x4fb0af[_0xb9e66f]);}const _0x527350=_0x38e706['reduce']((_0x30157e,_0x4f36c6)=>{if(isNullOrUndefined(_0x4f36c6['stage']))return _0x30157e;const _0x35576c=_0x4f36c6['amount']??-0x1*-0x16cc+0xae8+-0x21b4,_0x284145=_0x30157e['get'](_0x4f36c6['stage'])??0x364*0x1+-0xa4+0xb*-0x40;return _0x30157e['set'](_0x4f36c6['stage'],_0x284145+_0x35576c),_0x30157e;},new Map());return Array['from'](_0x527350,([_0x4e53b8,_0x1192b3])=>({'stage':_0x51f8e0['get'](_0x4e53b8)??_0x4e53b8,'amount':_0x1192b3}));}__name(getDealDashboard,'getDealDashboard');async function getDashboardReportData(_0x40c97e,_0x1ca1fa){let _0x4f8407,_0x3609b3;switch(_0x40c97e){case reportIds['report1']:_0x4f8407=reportData1;break;case reportIds['report2']:_0x4f8407=reportData2;break;case reportIds['report3']:_0x4f8407=reportData3;break;case reportIds['report4']:_0x4f8407=reportData4;break;case reportIds['report5']:_0x4f8407=reportData5;break;case reportIds['report6']:_0x4f8407=reportData6;break;case reportIds['report7']:_0x4f8407=reportData7;break;case reportIds['report8']:_0x4f8407=reportData8;break;case reportIds['report9']:_0x4f8407=reportData9;break;case reportIds['report10']:_0x4f8407=reportData10;break;case reportIds['report11']:_0x4f8407=reportData11;break;case reportIds['report12']:_0x3609b3=await createBigDigitReport(_0x1ca1fa,resourceNames['deal'],dealProps['amount']);break;case reportIds['report13']:_0x4f8407=await getDealDashboard();break;default:break;}return _0x4f8407&&(_0x3609b3={'id':_0x40c97e,'report':_0x1ca1fa,'data':_0x4f8407}),_0x3609b3;}__name(getDashboardReportData,'getDashboardReportData');

export { getOne };
