import type { ComponentProps } from 'react';
import * as elements from 'ui/elements';
import type { Elements as ActionElements } from './map/actions';
import type { Elements as ValuesElements } from './map/values';

function wrapComponentsMap<C, T extends Record<ValuesElements | ActionElements, C>>(arg: T) {
  return arg;
}

const components = wrapComponentsMap({
  selectProduct: elements.Select,
  selectClientRisk: elements.Select,
  selectClientType: elements.Select,
  selectSupplierCurrency: elements.Select,
  tbxLeaseObjectPrice: elements.InputNumber,
  tbxLeaseObjectPriceWthtVAT: elements.InputNumber,
  tbxVATInLeaseObjectPrice: elements.InputNumber,
  tbxSupplierDiscountRub: elements.InputNumber,
  tbxSupplierDiscountPerc: elements.InputNumber,
  radioBalanceHolder: elements.Radio,
  tbxSaleBonus: elements.InputNumber,
  tbxFirstPaymentPerc: elements.InputNumber,
  tbxFirstPaymentRub: elements.InputNumber,
  radioLastPaymentRule: elements.Segmented,
  tbxLastPaymentPerc: elements.InputNumber,
  tbxLastPaymentRub: elements.InputNumber,
  selectImportProgram: elements.Select,
  tbxImportProgramSum: elements.InputNumber,
  tbxAddEquipmentPrice: elements.InputNumber,
  tbxRedemptionPaymentSum: elements.InputNumber,
  tbxLeasingPeriod: elements.InputNumber,
  radioGraphType: elements.Radio,
  tbxParmentsDecreasePercent: elements.InputNumber,
  selectSeasonType: elements.Select,
  selectHighSeasonStart: elements.Select,
  tbxComissionPerc: elements.InputNumber,
  tbxComissionRub: elements.InputNumber,
  selectLeaseObjectType: elements.Select,
  selectBrand: elements.Select,
  selectModel: elements.Select,
  selectConfiguration: elements.Select,
  cbxLeaseObjectUsed: elements.Checkbox,
  radioDeliveryTime: elements.Segmented,
  tbxLeaseObjectCount: elements.InputNumber,
  selectLeaseObjectUseFor: elements.Select,
  tbxLeaseObjectYear: elements.InputNumber,
  selectLeaseObjectCategory: elements.Select,
  selectEngineType: elements.Select,
  tbxLeaseObjectMotorPower: elements.InputNumber,
  tbxEngineVolume: elements.InputNumber,
  tbxMaxMass: elements.InputNumber,
  tbxCountSeats: elements.InputNumber,
  tbxMaxSpeed: elements.InputNumber,
  cbxWithTrailer: elements.Checkbox,
  selectDealer: elements.Select,
  selectDealerPerson: elements.Select,
  selectDealerRewardCondition: elements.Select,
  tbxDealerRewardSumm: elements.InputNumber,
  selectDealerBroker: elements.Select,
  selectDealerBrokerRewardCondition: elements.Select,
  tbxDealerBrokerRewardSumm: elements.InputNumber,
  selectIndAgent: elements.Select,
  selectIndAgentRewardCondition: elements.Select,
  tbxIndAgentRewardSumm: elements.InputNumber,
  selectCalcDoubleAgent: elements.Select,
  selectCalcDoubleAgentRewardCondition: elements.Select,
  tbxCalcDoubleAgentRewardSumm: elements.InputNumber,
  selectCalcBroker: elements.Select,
  selectCalcBrokerRewardCondition: elements.Select,
  tbxCalcBrokerRewardSum: elements.InputNumber,
  selectCalcFinDepartment: elements.Select,
  selectFinDepartmentRewardCondtion: elements.Select,
  tbxFinDepartmentRewardSumm: elements.InputNumber,
  cbxInsDecentral: elements.Switch,
  radioInsKaskoType: elements.Radio,
  tbxInsFranchise: elements.InputNumber,
  cbxInsUnlimitDrivers: elements.Switch,
  tbxInsAgeDrivers: elements.InputNumber,
  tbxInsExpDrivers: elements.InputNumber,
  tbxINNForCalc: elements.InputNumber,
  selectGPSBrand: elements.Select,
  selectGPSModel: elements.Select,
  selectRegionRegistration: elements.Select,
  selectTownRegistration: elements.Select,
  radioInfuranceOPF: elements.Radio,
  selectRegistration: elements.Select,
  selectInsNSIB: elements.Select,
  selectRequirementTelematic: elements.Select,
  selectTracker: elements.Select,
  selectTelematic: elements.Select,
  selectTechnicalCard: elements.Select,
  cbxLastPaymentRedemption: elements.Switch,
  cbxPriceWithDiscount: elements.Switch,
  cbxFullPriceWithDiscount: elements.Switch,
  cbxCostIncrease: elements.Switch,
  cbxInsurance: elements.Switch,
  cbxRegistrationQuote: elements.Switch,
  cbxTechnicalCardQuote: elements.Switch,
  cbxNSIB: elements.Switch,
  cbxQuoteRedemptionGraph: elements.Switch,
  cbxShowFinGAP: elements.Switch,
  tbxQuoteName: elements.Input,
  radioQuoteContactGender: elements.Radio,
  cbxDisableChecks: elements.Switch,
  selectTarif: elements.Select,
  tbxCreditRate: elements.InputNumber,
  selectRate: elements.Select,
  tbxMaxPriceChange: elements.InputNumber,
  tbxImporterRewardPerc: elements.InputNumber,
  tbxImporterRewardRub: elements.InputNumber,
  selectLead: elements.Select,
  selectOpportunity: elements.Select,
  selectQuote: elements.Select,
  cbxRecalcWithRevision: elements.Checkbox,
  tbxIRR_Perc: elements.InputNumber,
  tbxMileage: elements.InputNumber,
  tbxEngineHours: elements.InputNumber,
  radioCalcType: elements.Segmented,
  tbxTotalPayments: elements.InputNumber,
  radioObjectRegistration: elements.Radio,
  selectObjectRegionRegistration: elements.Select,
  tbxVehicleTaxInYear: elements.InputNumber,
  tbxVehicleTaxInLeasingPeriod: elements.InputNumber,
  selectObjectCategoryTax: elements.Select,
  selectObjectTypeTax: elements.Select,
  radioTypePTS: elements.Radio,
  selectLegalClientRegion: elements.Select,
  selectLegalClientTown: elements.Select,
  selectSubsidy: elements.Select,
  selectFuelCard: elements.Select,
  tbxMinPriceChange: elements.InputNumber,
  tbxBonusCoefficient: elements.InputNumber,

  /** Readonly Elements */
  labelLeaseObjectRisk: elements.Text,
  tbxInsKaskoPriceLeasePeriod: elements.InputNumber,
  labelIrrInfo: elements.Text,
  labelRegistrationDescription: elements.Text,
  labelDepreciationGroup: elements.Text,
  tbxSubsidySum: elements.InputNumber,

  /** Button Elements */
  btnCreateKP: elements.Button,
  btnCalculate: elements.Button,

  /** Link Elements */
  linkDownloadKp: elements.Link,
  linkLeadUrl: elements.Link,
  linkOpportunityUrl: elements.Link,
  linkQuoteUrl: elements.Link,
});

export default components;

type ComponentsTypes = typeof components;

export type ElementsProps = {
  [Component in keyof ComponentsTypes]: ComponentProps<ComponentsTypes[Component]>;
};
