import { MAX_FRANCHISE, MAX_LEASING_PERIOD } from 'constants/values';
import dayjs from 'dayjs';
import { formatter, formatterExtra, parser } from 'tools/number';
import DownloadOutlined from 'ui/elements/icons/DownloadOutlined';
import CurrencyAddon from '../addons/currency-addon';
import type { ElementsProps } from './elements-components';

const props: Partial<ElementsProps> = {
  tbxLeaseObjectPrice: {
    min: 0,
    max: 1_000_000_000,
    step: 10_000,
    precision: 2,
    parser,
    formatter,
    addonAfter: CurrencyAddon,
  },
  tbxLeaseObjectPriceWthtVAT: {
    min: 0,
    max: 1_000_000_000,
    step: 10_000,
    precision: 2,
    parser,
    formatter,
    addonAfter: CurrencyAddon,
  },
  tbxVATInLeaseObjectPrice: {
    min: 0,
    max: 1_000_000_000,
    step: 10_000,
    precision: 2,
    parser,
    formatter,
    addonAfter: CurrencyAddon,
  },
  tbxEngineHours: {
    min: 0,
    step: 10,
    precision: 2,
    addonAfter: 'ч.',
  },
  tbxSupplierDiscountRub: {
    min: 0,
    max: 1_000_000_000,
    step: 10_000,
    precision: 2,
    parser,
    formatter,
    addonAfter: '₽',
  },
  tbxSupplierDiscountPerc: {
    min: 0,
    max: 100,
    precision: 2,

    addonAfter: '%',
  },
  radioBalanceHolder: {
    optionType: 'button',
    buttonStyle: 'solid',
  },
  tbxSaleBonus: {
    min: 0,
    // max: 1.30,
    step: 0.1,
    precision: 2,

    addonAfter: '%',
  },
  radioLastPaymentRule: {
    block: true,
  },
  tbxFirstPaymentPerc: {
    min: 0,
    max: 50,
    precision: 4,
    parser,
    formatter: formatterExtra,
    addonAfter: '%',
  },
  tbxFirstPaymentRub: {
    min: 0,
    max: 1_000_000_000,
    step: 10_000,
    precision: 2,
    parser,
    formatter,
    addonAfter: '₽',
  },
  tbxLastPaymentPerc: {
    min: 0,
    max: 70,
    step: 1,
    precision: 6,
    parser,
    formatter: formatterExtra,
    addonAfter: '%',
  },
  tbxLastPaymentRub: {
    min: 0,
    max: 1_000_000_000,
    step: 10_000,
    precision: 2,
    parser,
    formatter,
    addonAfter: '₽',
  },
  tbxRedemptionPaymentSum: {
    min: 1000,
    max: 2000,
    step: 1000,
    precision: 2,
    parser,
    formatter,
    addonAfter: '₽',
  },
  tbxLeasingPeriod: {
    min: 13,
    max: MAX_LEASING_PERIOD,
    addonAfter: 'мес.',
  },
  tbxSubsidySum: {
    min: 0,
    precision: 2,
    addonAfter: '₽',
  },
  tbxImportProgramSum: {
    min: 0,
    precision: 2,
    addonAfter: '₽',
  },
  tbxAddEquipmentPrice: {
    min: 0,
    precision: 2,
    addonAfter: '₽',
  },
  tbxParmentsDecreasePercent: {
    min: 50,
    max: 99,
  },
  tbxComissionPerc: {
    min: 0,
    max: 100,
  },
  tbxComissionRub: {
    min: 0,
    max: 1_000_000_000,
    step: 10_000,
    parser,
    formatter,
    addonAfter: '₽',
  },
  selectLeaseObjectType: {
    showSearch: true,
    optionFilterProp: 'label',
  },
  selectBrand: {
    showSearch: true,
    optionFilterProp: 'label',
  },
  selectModel: {
    showSearch: true,
    optionFilterProp: 'label',
  },
  selectConfiguration: {
    showSearch: true,
    optionFilterProp: 'label',
  },
  tbxLeaseObjectCount: {
    min: 1,
    max: 1000,
    addonAfter: 'шт.',
  },
  selectLeaseObjectUseFor: {
    showSearch: true,
    optionFilterProp: 'label',
  },
  tbxLeaseObjectYear: {
    min: 1994,
    max: dayjs().year(),
  },
  selectLeaseObjectCategory: {
    showSearch: false,
  },
  selectEngineType: {
    showSearch: true,
    optionFilterProp: 'label',
  },
  tbxLeaseObjectMotorPower: {
    min: 0,
    max: 20_000,
    step: 10,
    precision: 2,
    parser,
    formatter,
    addonAfter: 'л.с.',
  },
  tbxEngineVolume: {
    min: 0,
    max: 99.9999,
    step: 0.5,
    precision: 4,
    parser,
    formatter: formatterExtra,
    addonAfter: 'л',
  },
  tbxMaxMass: {
    min: 0,
    max: 999_999,
    step: 100,
    parser,
    formatter,
    addonAfter: 'кг',
  },
  tbxCountSeats: {
    min: 0,
    max: 2000,
    parser,
    formatter,
  },
  tbxMaxSpeed: {
    min: 0,
    max: 2000,
    parser,
    formatter,
    addonAfter: 'км/ч',
  },
  selectDealer: {
    showSearch: true,
    optionFilterProp: 'label',
  },
  tbxDealerRewardSumm: {
    min: 0,
    max: 20,
    step: 0.1,
    precision: 2,
  },
  tbxDealerBrokerRewardSumm: {
    min: 0,
    max: 20,
    step: 0.1,
    precision: 2,
  },
  tbxIndAgentRewardSumm: {
    min: 0,
    max: 20,
    step: 0.1,
    precision: 2,
  },
  tbxCalcDoubleAgentRewardSumm: {
    min: 0,
    max: 20,
    step: 0.1,
    precision: 2,
  },
  tbxCalcBrokerRewardSum: {
    min: 0,
    max: 20,
    step: 0.1,
    precision: 2,
  },
  tbxFinDepartmentRewardSumm: {
    min: 0,
    max: 20,
    step: 0.1,
    precision: 2,
  },
  radioInsKaskoType: {
    optionType: 'button',
    buttonStyle: 'solid',
  },
  tbxInsFranchise: {
    min: 0,
    max: MAX_FRANCHISE,
    step: 10_000,
    precision: 2,
    parser,
    formatter,
    addonAfter: '₽',
  },
  tbxInsAgeDrivers: {
    // min: 18,
    // max: 99,
  },
  tbxInsExpDrivers: {
    // min: 0,
    // max: 99,
  },
  selectRegionRegistration: {
    showSearch: true,
    optionFilterProp: 'label',
  },
  selectTownRegistration: {
    showSearch: true,
    optionFilterProp: 'label',
  },
  radioQuoteContactGender: {
    optionType: 'button',
    buttonStyle: 'solid',
  },
  btnCreateKP: {
    type: 'primary',
    text: 'Создать КП',
  },
  tbxCreditRate: {
    min: 0,
    max: 99.99,
    step: 0.1,
  },
  tbxMaxPriceChange: {
    min: 0,
    max: 34_999_990,
    step: 10_000,
    parser,
    formatter,
  },
  tbxMinPriceChange: {
    min: 0,
    max: 34_999_990,
    step: 10_000,
    parser,
    formatter,
  },
  tbxImporterRewardPerc: {
    min: 0,
    max: 99.99,
    step: 0.1,
    precision: 2,
  },
  tbxImporterRewardRub: {
    min: 0,
    max: 1_000_000_000,
    step: 10_000,
    precision: 2,
    parser,
    formatter,
  },
  selectLead: {
    showSearch: true,
    optionFilterProp: 'label',
  },
  selectOpportunity: {
    showSearch: true,
    optionFilterProp: 'label',
  },
  selectQuote: {
    showSearch: true,
    optionFilterProp: 'label',
  },
  btnCalculate: {
    text: 'Рассчитать график',
    type: 'primary',
  },
  tbxIRR_Perc: {
    min: 0,
    max: 500,
    step: 0.0001,
    precision: 6,
    parser,
    formatter: formatterExtra,
    addonAfter: '%',
  },
  linkDownloadKp: {
    type: 'primary',
    text: 'Скачать КП',
    icon: DownloadOutlined,
  },
  tbxMileage: {
    min: 0,
    step: 100,
    precision: 2,
    addonAfter: 'км',
  },
  cbxRecalcWithRevision: {
    text: 'Пересчет без пересмотра',
    style: {
      marginBottom: '8px',
    },
  },
  tbxTotalPayments: {
    min: 0,
    step: 1000,
    precision: 2,
    parser,
    formatter,
    addonAfter: '₽',
  },
  tbxVehicleTaxInYear: {
    min: 0,
    step: 100,
    max: 9_999_999,
    precision: 2,
    parser,
    formatter,
    addonAfter: '₽',
  },
  tbxVehicleTaxInLeasingPeriod: {
    min: 0,
    step: 100,
    max: 9_999_999,
    precision: 2,
    parser,
    formatter,
    addonAfter: '₽',
  },
  selectObjectRegionRegistration: {
    showSearch: true,
    optionFilterProp: 'label',
  },
  tbxInsKaskoPriceLeasePeriod: {
    min: 0,
    precision: 2,
    parser,
    formatter,
    readOnly: true,
    controls: false,
  },
  selectLegalClientRegion: {
    showSearch: true,
    optionFilterProp: 'label',
  },
  selectLegalClientTown: {
    showSearch: true,
    optionFilterProp: 'label',
  },
  radioInfuranceOPF: {
    optionType: 'button',
    buttonStyle: 'solid',
  },
  radioGraphType: {
    spaceProps: {
      direction: 'vertical',
    },
  },
  radioObjectRegistration: {
    spaceProps: {
      direction: 'vertical',
    },
  },
  radioTypePTS: {
    spaceProps: {
      direction: 'vertical',
    },
  },
};

export default props;
