import type { CalculationValues, Values } from 'stores/calculation/values/types';

function wrapElementsMap<T extends Record<string, Values>>(arg: T) {
  return arg;
}

const elementsToValues = wrapElementsMap({
  selectLead: 'lead',
  selectOpportunity: 'opportunity',
  selectQuote: 'quote',
  cbxRecalcWithRevision: 'recalcWithRevision',
  selectProduct: 'product',
  selectClientRisk: 'clientRisk',
  selectClientType: 'clientType',
  tbxLeaseObjectPrice: 'leaseObjectPrice',
  tbxLeaseObjectPriceWthtVAT: 'leaseObjectPriceWthtVAT',
  tbxVATInLeaseObjectPrice: 'VATInLeaseObjectPrice',
  tbxEngineHours: 'engineHours',
  selectSupplierCurrency: 'supplierCurrency',
  tbxSupplierDiscountRub: 'supplierDiscountRub',
  tbxSupplierDiscountPerc: 'supplierDiscountPerc',
  tbxLeasingPeriod: 'leasingPeriod',
  tbxFirstPaymentPerc: 'firstPaymentPerc',
  tbxFirstPaymentRub: 'firstPaymentRub',
  tbxLastPaymentPerc: 'lastPaymentPerc',
  tbxLastPaymentRub: 'lastPaymentRub',
  radioLastPaymentRule: 'lastPaymentRule',
  selectImportProgram: 'importProgram',
  tbxImportProgramSum: 'importProgramSum',
  tbxAddEquipmentPrice: 'addEquipmentPrice',
  tbxRedemptionPaymentSum: 'redemptionPaymentSum',
  radioBalanceHolder: 'balanceHolder',
  radioGraphType: 'graphType',
  tbxParmentsDecreasePercent: 'parmentsDecreasePercent',
  selectSeasonType: 'seasonType',
  selectHighSeasonStart: 'highSeasonStart',
  tbxComissionPerc: 'comissionPerc',
  tbxComissionRub: 'comissionRub',
  tbxSaleBonus: 'saleBonus',
  tbxIRR_Perc: 'IRR_Perc',
  selectLeaseObjectType: 'leaseObjectType',
  radioDeliveryTime: 'deliveryTime',
  tbxLeaseObjectCount: 'leaseObjectCount',
  cbxWithTrailer: 'withTrailer',
  cbxLeaseObjectUsed: 'leaseObjectUsed',
  tbxMaxMass: 'maxMass',
  tbxCountSeats: 'countSeats',
  tbxMaxSpeed: 'maxSpeed',
  selectBrand: 'brand',
  selectModel: 'model',
  selectConfiguration: 'configuration',
  tbxLeaseObjectYear: 'leaseObjectYear',
  selectEngineType: 'engineType',
  selectLeaseObjectCategory: 'leaseObjectCategory',
  tbxLeaseObjectMotorPower: 'leaseObjectMotorPower',
  tbxEngineVolume: 'engineVolume',
  selectLeaseObjectUseFor: 'leaseObjectUseFor',
  selectDealer: 'dealer',
  selectDealerPerson: 'dealerPerson',
  selectDealerRewardCondition: 'dealerRewardCondition',
  tbxDealerRewardSumm: 'dealerRewardSumm',
  selectDealerBroker: 'dealerBroker',
  selectDealerBrokerRewardCondition: 'dealerBrokerRewardCondition',
  tbxDealerBrokerRewardSumm: 'dealerBrokerRewardSumm',
  selectIndAgent: 'indAgent',
  selectIndAgentRewardCondition: 'indAgentRewardCondition',
  tbxIndAgentRewardSumm: 'indAgentRewardSumm',
  selectCalcDoubleAgent: 'calcDoubleAgent',
  selectCalcDoubleAgentRewardCondition: 'calcDoubleAgentRewardCondition',
  tbxCalcDoubleAgentRewardSumm: 'calcDoubleAgentRewardSumm',
  selectCalcBroker: 'calcBroker',
  selectCalcBrokerRewardCondition: 'calcBrokerRewardCondition',
  tbxCalcBrokerRewardSum: 'calcBrokerRewardSum',
  selectCalcFinDepartment: 'calcFinDepartment',
  selectFinDepartmentRewardCondtion: 'finDepartmentRewardCondtion',
  tbxFinDepartmentRewardSumm: 'finDepartmentRewardSumm',
  selectGPSBrand: 'GPSBrand',
  selectGPSModel: 'GPSModel',
  selectRegionRegistration: 'regionRegistration',
  selectTownRegistration: 'townRegistration',
  radioInfuranceOPF: 'infuranceOPF',
  radioInsKaskoType: 'insKaskoType',
  cbxInsDecentral: 'insDecentral',
  tbxInsFranchise: 'insFranchise',
  cbxInsUnlimitDrivers: 'insUnlimitDrivers',
  tbxInsAgeDrivers: 'insAgeDrivers',
  tbxInsExpDrivers: 'insExpDrivers',
  tbxINNForCalc: 'INNForCalc',
  cbxLastPaymentRedemption: 'lastPaymentRedemption',
  cbxPriceWithDiscount: 'priceWithDiscount',
  cbxFullPriceWithDiscount: 'fullPriceWithDiscount',
  cbxCostIncrease: 'costIncrease',
  cbxInsurance: 'insurance',
  cbxRegistrationQuote: 'registrationQuote',
  cbxTechnicalCardQuote: 'technicalCardQuote',
  cbxNSIB: 'NSIB',
  tbxQuoteName: 'quoteName',
  radioQuoteContactGender: 'quoteContactGender',
  cbxQuoteRedemptionGraph: 'quoteRedemptionGraph',
  cbxShowFinGAP: 'showFinGAP',
  selectTarif: 'tarif',
  tbxCreditRate: 'creditRate',
  selectRate: 'rate',
  tbxMaxPriceChange: 'maxPriceChange',
  tbxImporterRewardPerc: 'importerRewardPerc',
  tbxImporterRewardRub: 'importerRewardRub',
  cbxDisableChecks: 'disableChecks',
  selectRegistration: 'registration',
  selectInsNSIB: 'insNSIB',
  selectTechnicalCard: 'technicalCard',
  selectRequirementTelematic: 'requirementTelematic',
  selectTelematic: 'telematic',
  selectTracker: 'tracker',
  tbxMileage: 'mileage',
  radioCalcType: 'calcType',
  tbxTotalPayments: 'totalPayments',
  radioObjectRegistration: 'objectRegistration',
  selectObjectRegionRegistration: 'objectRegionRegistration',
  tbxVehicleTaxInYear: 'vehicleTaxInYear',
  tbxVehicleTaxInLeasingPeriod: 'vehicleTaxInLeasingPeriod',
  selectObjectCategoryTax: 'objectCategoryTax',
  selectObjectTypeTax: 'objectTypeTax',
  radioTypePTS: 'typePTS',
  selectLegalClientRegion: 'legalClientRegion',
  selectLegalClientTown: 'legalClientTown',
  selectSubsidy: 'subsidy',
  tbxSubsidySum: 'subsidySum',
  selectFuelCard: 'fuelCard',
  tbxMinPriceChange: 'minPriceChange',
  tbxBonusCoefficient: 'bonusCoefficient',

  /** Readonly Elements */
  labelLeaseObjectRisk: 'leaseObjectRiskName',
  tbxInsKaskoPriceLeasePeriod: 'insKaskoPriceLeasePeriod',
  labelIrrInfo: 'irrInfo',
  labelRegistrationDescription: 'registrationDescription',
  labelDepreciationGroup: 'depreciationGroup',

  /** Link Elements */
  linkDownloadKp: 'kpUrl',
  linkLeadUrl: 'leadUrl',
  linkOpportunityUrl: 'opportunityUrl',
  linkQuoteUrl: 'quoteUrl',
});

export default elementsToValues;

type ElementsValues = typeof elementsToValues;

export type ElementsTypes = {
  [Key in keyof ElementsValues]: CalculationValues[ElementsValues[Key]];
};

export type Elements = keyof ElementsTypes;

export function getValueName(elementName: Elements) {
  return elementsToValues[elementName];
}
