/* eslint-disable jsdoc/multiline-blocks */
/* eslint-disable canonical/sort-keys */
import CurrencyAddon from '../addons/currency-addon';
import type { ElementsProps } from './elements-components';
import { MAX_FRANCHISE, MAX_LEASING_PERIOD } from '@/constants/values';
import dayjs from 'dayjs';
import { parser } from 'tools/number';
import { DownloadOutlined, PlusOutlined } from 'ui/elements/icons';
import { createFormatter } from 'ui/elements/InputNumber';

const formatter = createFormatter({ minimumFractionDigits: 2, maximumFractionDigits: 2 });

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

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

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

export default props;
