From 77f55f5108a4ba661f3a3167519e4fb2b1cbf1b3 Mon Sep 17 00:00:00 2001 From: vchikalkin Date: Mon, 8 May 2023 19:50:52 +0300 Subject: [PATCH] add elt kasko request --- .../Components/Calculation/Form/ELT/Kasko.tsx | 105 ++++- .../Calculation/Form/ELT/lib/make-request.ts | 435 +++++++++++++++++- apps/web/config/schema/elt.ts | 11 +- apps/web/graphql/crm.query.graphql | 5 + apps/web/graphql/crm.types.ts | 8 +- 5 files changed, 553 insertions(+), 11 deletions(-) diff --git a/apps/web/Components/Calculation/Form/ELT/Kasko.tsx b/apps/web/Components/Calculation/Form/ELT/Kasko.tsx index 5901b1c..8731764 100644 --- a/apps/web/Components/Calculation/Form/ELT/Kasko.tsx +++ b/apps/web/Components/Calculation/Form/ELT/Kasko.tsx @@ -1,21 +1,116 @@ +/* eslint-disable sonarjs/cognitive-complexity */ import { PolicyTable, ReloadButton, Validation } from './Components'; import { columns } from './lib/config'; -import type { StoreSelector } from './types'; +import { makeEltKaskoRequest } from './lib/make-request'; +import type { Row, StoreSelector } from './types'; +import { getEltKasko } from '@/api/elt/query'; +import { STALE_TIME } from '@/constants/request'; +import { MAX_FRANCHISE, MAX_INSURANCE, MIN_INSURANCE } from '@/constants/values'; +import { useStore } from '@/stores/hooks'; +import { useApolloClient } from '@apollo/client'; +import type { QueryFunctionContext } from '@tanstack/react-query'; +import { useQueries } from '@tanstack/react-query'; import { clone } from 'tools'; import { Flex } from 'ui/grid'; const storeSelector: StoreSelector = ({ kasko }) => kasko; -function handleOnClick() {} - export function Kasko() { + const store = useStore(); + const { $tables } = store; + const rows = $tables.elt.kasko.getRows; + + const apolloClient = useApolloClient(); + + const queries = useQueries({ + queries: rows.map(({ key, id }) => ({ + enabled: false, + queryFn: async (context: QueryFunctionContext) => { + const payload = await makeEltKaskoRequest({ apolloClient, store }, id); + const res = await getEltKasko(payload, context); + const companyRes = res[id]; + + return { ...companyRes, id, key }; + }, + queryKey: ['elt', 'kasko', id], + refetchOnWindowFocus: false, + staleTime: STALE_TIME, + })), + }); + + async function handleOnClick() { + const fetchingRows = rows.map((x) => ({ ...x, status: 'fetching', sum: 0 })); + $tables.elt.kasko.setRows(fetchingRows); + + queries.forEach(({ refetch }) => { + refetch().then((res) => { + if (res.data) { + const { key, kaskoSum, message, skCalcId, totalFranchise } = res.data; + let { error } = res.data; + + if (totalFranchise > MAX_FRANCHISE) { + error ||= `Франшиза по страховке превышает максимально допустимое значение: ${Intl.NumberFormat( + 'ru', + { + currency: 'RUB', + style: 'currency', + } + ).format(MAX_FRANCHISE)}`; + } + + if (kaskoSum > MAX_INSURANCE) { + error ||= `Сумма по страховке превышает максимально допустимое значение по стоимости КАСКО: ${Intl.NumberFormat( + 'ru', + { + currency: 'RUB', + style: 'currency', + } + ).format(MAX_INSURANCE)}`; + } + + if (kaskoSum < MIN_INSURANCE) { + error ||= `Сумма по страховке не должна быть меньше допустимого значения по стоимости КАСКО: ${Intl.NumberFormat( + 'ru', + { + currency: 'RUB', + style: 'currency', + } + ).format(MIN_INSURANCE)}`; + } + + $tables.elt.kasko.setRow({ + key, + message: error || message, + numCalc: 0, + skCalcId, + status: error ? 'error' : null, + sum: kaskoSum, + totalFranchise, + }); + } + }); + }); + } + + function handleOnSelectRow(row: Row) { + $tables.insurance.row('kasko').column('insuranceCompany').setValue(row.key); + $tables.insurance.row('kasko').column('insCost').setValue(row.sum); + } + const kaskoColumns = clone(columns); kaskoColumns[0].title = 'Страховая компания КАСКО'; - kaskoColumns[3].title = ; + kaskoColumns[3].title = ( + handleOnClick()} /> + ); + return ( - + handleOnSelectRow(row)} + /> ); } diff --git a/apps/web/Components/Calculation/Form/ELT/lib/make-request.ts b/apps/web/Components/Calculation/Form/ELT/lib/make-request.ts index bbfbdb1..afb2d7f 100644 --- a/apps/web/Components/Calculation/Form/ELT/lib/make-request.ts +++ b/apps/web/Components/Calculation/Form/ELT/lib/make-request.ts @@ -1,6 +1,6 @@ /* eslint-disable sonarjs/cognitive-complexity */ /* eslint-disable complexity */ -import type { RequestEltOsago } from '@/api/elt/types'; +import type { RequestEltKasko, RequestEltOsago } from '@/api/elt/types'; import * as CRMTypes from '@/graphql/crm.types'; import type { ProcessContext } from '@/process/types'; import dayjs from 'dayjs'; @@ -279,3 +279,436 @@ export async function makeEltOsagoRequest( }, }; } + +export async function makeEltKaskoRequest( + { store, apolloClient }: Pick, + companyId: string +): Promise { + const { $calculation } = store; + + const currentDate = dayjs().toDate(); + + const regionId = $calculation.element('selectLegalClientRegion').getValue(); + let evo_region: CRMTypes.GetRegionQuery['evo_region'] = null; + if (regionId) { + const { data } = await apolloClient.query({ + query: CRMTypes.GetRegionDocument, + variables: { regionId }, + }); + ({ evo_region } = data); + } + + const townId = $calculation.element('selectLegalClientTown').getValue(); + let evo_town: CRMTypes.GetTownQuery['evo_town'] = null; + if (townId) { + const { data } = await apolloClient.query({ + query: CRMTypes.GetTownDocument, + variables: { townId }, + }); + ({ evo_town } = data); + } + + const kladr = evo_town?.evo_kladr_id || evo_region?.evo_kladr_id || ''; + + const leaseObjectTypeId = $calculation.element('selectLeaseObjectType').getValue(); + let evo_leasingobject_type: CRMTypes.GetLeaseObjectTypeQuery['evo_leasingobject_type'] = null; + if (leaseObjectTypeId) { + const { data } = await apolloClient.query({ + query: CRMTypes.GetLeaseObjectTypeDocument, + variables: { leaseObjectTypeId }, + }); + ({ evo_leasingobject_type } = data); + } + + const leaseObjectCategory = $calculation.element('selectLeaseObjectCategory').getValue(); + + const brand = $calculation.element('selectBrand').getValue(); + let evo_brand: CRMTypes.GetBrandQuery['evo_brand'] = null; + if (brand) { + const { data } = await apolloClient.query({ + query: CRMTypes.GetBrandDocument, + variables: { brandId: brand }, + }); + ({ evo_brand } = data); + } + const brandId = evo_brand?.evo_id || ''; + + const model = $calculation.element('selectModel').getValue(); + let evo_model: CRMTypes.GetModelQuery['evo_model'] = null; + if (model) { + const { data } = await apolloClient.query({ + query: CRMTypes.GetModelDocument, + variables: { modelId: model }, + }); + ({ evo_model } = data); + } + const modelId = evo_model?.evo_id || ''; + + const leaseObjectUsed = $calculation.element('cbxLeaseObjectUsed').getValue(); + + const productId = $calculation.element('selectProduct').getValue(); + let evo_baseproduct: CRMTypes.GetProductQuery['evo_baseproduct'] = null; + if (productId) { + const { data } = await apolloClient.query({ + query: CRMTypes.GetProductDocument, + variables: { productId }, + }); + ({ evo_baseproduct } = data); + } + + const leaseObjectYear = $calculation.element('tbxLeaseObjectYear').getValue(); + let isNew = true; + if ( + leaseObjectUsed === true || + (leaseObjectUsed === false && + evo_baseproduct?.evo_sale_without_nds === true && + leaseObjectYear !== currentDate.getFullYear()) + ) { + isNew = false; + } + + const vehicleYear = leaseObjectYear; + let vehicleDate; + if ( + leaseObjectUsed === true || + (leaseObjectUsed === false && + evo_baseproduct?.evo_sale_without_nds === true && + leaseObjectYear !== currentDate.getFullYear()) + ) { + vehicleDate = new Date(`${vehicleYear}-01-01`); + } + const vehicleDateSpecified = getSpecified(vehicleDate); + + const power = $calculation.element('tbxLeaseObjectMotorPower').getValue(); + const powerSpecified = getSpecified(power); + + let country = 0; + let countrySpecified = false; + if ( + (leaseObjectCategory === 100_000_002 || + (evo_leasingobject_type?.evo_id && + ['6', '9', '10', '8'].includes(evo_leasingobject_type?.evo_id))) && + evo_brand?.evo_brand_owner === 100_000_001 + ) { + country = 1; + countrySpecified = true; + } + + const mapEngineType: Record = { + 100_000_000: '0', + 100_000_001: '1', + 100_000_003: '2', + 100_000_004: '3', + }; + + let engineType = '5'; + const engineTypeValue = $calculation.element('selectEngineType').getValue(); + if (engineTypeValue) { + engineType = mapEngineType[engineTypeValue] || '5'; + } + + const leasingPeriod = $calculation.element('tbxLeasingPeriod').getValue(); + const duration = leasingPeriod < 12 ? 12 : leasingPeriod; + + const cost = + $calculation.$values.getValue('plPriceRub') - + $calculation.$values.getValue('discountRub') - + $calculation.$values.getValue('importProgramSum') + + $calculation.$values.getValue('addEquipmentPrice'); + + let notConfirmedDamages = 0; + let notConfirmedDamagesSpecified = false; + let notConfirmedGlassesDamages = 0; + let notConfirmedGlassesDamagesSpecified = false; + let outsideRoads = false; + let outsideRoadsSpecified = false; + let selfIgnition = false; + let selfIgnitionSpecified = false; + if ( + leaseObjectCategory === 100_000_002 || + (evo_leasingobject_type?.evo_id && ['6', '9', '10'].includes(evo_leasingobject_type?.evo_id)) + ) { + notConfirmedGlassesDamages = 3; + notConfirmedGlassesDamagesSpecified = true; + notConfirmedDamages = 2; + notConfirmedDamagesSpecified = true; + selfIgnition = true; + selfIgnitionSpecified = getSpecified(selfIgnition); + outsideRoads = true; + outsideRoadsSpecified = true; + } + + const franchise = $calculation.element('tbxInsFranchise').getValue(); + const franchiseSpecified = getSpecified(franchise); + + let puuMark = ''; + const gpsBrandId = $calculation.element('selectGPSBrand').getValue(); + if (gpsBrandId) { + const { + data: { evo_gps_brands }, + } = await apolloClient.query({ + query: CRMTypes.GetGpsBrandsDocument, + }); + puuMark = evo_gps_brands?.find((x) => x?.value === gpsBrandId)?.evo_id || puuMark; + } + + let puuModel = ''; + const gpsModelId = $calculation.element('selectGPSModel').getValue(); + if (gpsModelId) { + const { + data: { evo_gps_models }, + } = await apolloClient.query({ + query: CRMTypes.GetGpsModelsDocument, + }); + puuModel = evo_gps_models?.find((x) => x?.value === gpsModelId)?.evo_id || puuModel; + } + + const puuModelSpecified = getSpecified(puuModel); + + let age = $calculation.element('tbxInsAgeDrivers').getValue(); + let experience = $calculation.element('tbxInsExpDrivers').getValue(); + const sex = '0'; + let driversCount = 1; + + const risk = + evo_leasingobject_type?.evo_id && ['6', '9', '10'].includes(evo_leasingobject_type?.evo_id) + ? 3 + : 0; + + if ($calculation.element('cbxInsUnlimitDrivers').getValue()) { + age = 18; + experience = 0; + driversCount = 0; + } + const sexSpecified = getSpecified(sex); + + let maxAllowedMass = 0; + if (leaseObjectCategory === 100_000_002) { + maxAllowedMass = $calculation.element('tbxMaxMass').getValue(); + } + const maxAllowedMassSpecified = getSpecified(maxAllowedMass); + + let mileage = 0; + if (leaseObjectUsed === true) { + mileage = $calculation.element('tbxMileage').getValue(); + } + + if ( + leaseObjectUsed === false && + evo_baseproduct?.evo_sale_without_nds === true && + leaseObjectYear !== currentDate.getFullYear() + ) { + mileage = 0; + } + + let vin = ''; + + if (leaseObjectUsed === true) { + vin = $calculation.element('tbxVIN').getValue() || vin; + } + + const mileageSpecified = getSpecified(mileage); + + let vehicleUsage = 0; + + const mapVehicleUsage: Record = { + 100_000_000: 0, + 100_000_001: 1, + 100_000_002: 5, + 100_000_003: 5, + 100_000_004: 2, + 100_000_005: 6, + 100_000_006: 5, + 100_000_007: 4, + 100_000_008: 4, + 100_000_009: 0, + 100_000_010: 0, + 100_000_011: 3, + 100_000_012: 3, + 100_000_013: 9, + }; + + const leaseObjectUseFor = $calculation.element('selectLeaseObjectUseFor').getValue(); + if (leaseObjectUseFor) { + vehicleUsage = mapVehicleUsage[leaseObjectUseFor] || 0; + } + const vehicleUsageSpecified = getSpecified(vehicleUsage); + + let seatingCapacity = 0; + if (leaseObjectCategory === 100_000_003) { + seatingCapacity = $calculation.element('tbxCountSeats').getValue(); + } + const seatingCapacitySpecified = getSpecified(seatingCapacity); + + const mapCategory: Record = { + 100_000_000: 'A', + 100_000_001: 'B', + // 100000002: 'C2', + 100_000_003: 'D', + 100_000_004: 'E1', + }; + + let category = ''; + + if (leaseObjectCategory) { + category = mapCategory[leaseObjectCategory]; + } + + if (leaseObjectCategory === 100_000_002) + switch (evo_leasingobject_type?.evo_id) { + case '7': { + category = 'C1'; + break; + } + case '3': { + category = 'C3'; + break; + } + default: { + category = 'C2'; + break; + } + } + + const classification = + leaseObjectCategory && [100_000_002, 100_000_003, 100_000_004].includes(leaseObjectCategory) + ? '11635' + : '0'; + + let INN = ''; + const leadid = $calculation.element('selectLead').getValue(); + if (leadid) { + const { + data: { lead }, + } = await apolloClient.query({ + query: CRMTypes.GetLeadDocument, + variables: { leadid }, + }); + INN = lead?.evo_inn || INN; + } + + const lesseSubjectType = (INN.length === 10 && 1) || (INN.length === 12 && 2) || 0; + + const mapLeaseObjectUseForToIndustry: Record = { + 100_000_014: 30, + 100_000_015: 15, + 100_000_016: 3, + 100_000_017: 26, + 100_000_018: 2, + 100_000_019: 6, + }; + + let specialMachineryIndustry = 0; + let specialMachineryMover = 0; + let specialMachineryType = 0; + if (evo_leasingobject_type?.evo_id && ['6', '9', '10'].includes(evo_leasingobject_type?.evo_id)) { + specialMachineryType = Number(evo_model?.evo_vehicle_body_typeidData?.evo_id_elt || 0); + specialMachineryIndustry = leaseObjectUseFor + ? mapLeaseObjectUseForToIndustry[leaseObjectUseFor] + : specialMachineryIndustry; + specialMachineryMover = evo_model?.evo_running_gear === 100_000_001 ? 2 : 1; + } + + return { + ELTParams: { + Insurer: { + SubjectType: 1, + SubjectTypeSpecified: true, + }, + Lessee: { + INN, + SubjectType: lesseSubjectType, + SubjectTypeSpecified: true, + }, + OfficialDealer: true, + OfficialDealerSpecified: true, + Owner: { + SubjectType: 1, + SubjectTypeSpecified: true, + }, + PUUs: puuMark + ? [ + { + mark: puuMark, + model: puuModel, + modelSpecified: puuModelSpecified, + }, + ] + : [], + STOA: '0', + approvedDriving: 2, + approvedDrivingSpecified: true, + bankId: '245', + cost, + currency: 'RUR', + drivers: [{ age, experience, sex, sexSpecified }], + driversCount, + duration, + franchise, + franchiseSpecified, + isNew, + modification: { + KPPTypeId: 1, + country, + countrySpecified, + engineType, + engineVolume: 0, + engineVolumeSpecified: true, + power, + powerSpecified, + }, + notConfirmedDamages, + notConfirmedDamagesSpecified, + notConfirmedGlassesDamages, + notConfirmedGlassesDamagesSpecified, + outsideRoads, + outsideRoadsSpecified, + payType: '0', + risk, + selfIgnition, + selfIgnitionSpecified, + ssType: '1', + usageStart: currentDate, + vehicle: { + category, + classification, + maxAllowedMass, + maxAllowedMassSpecified, + mileage, + mileageSpecified, + seatingCapacity, + seatingCapacitySpecified, + vehicleUsage, + vehicleUsageSpecified, + vin, + }, + vehicleDate, + vehicleDateSpecified, + vehicleYear, + // FullDriversInfo: [ + // { + // surname, + // name, + // patronymic, + // sex, + // sexSpecified, + // expertienceStart, + // }, + // ], + }, + companyIds: [companyId], + preparams: { + brandId, + kladr, + modelId, + specialMachinery: { + industry: specialMachineryIndustry, + industrySpecified: getSpecified(specialMachineryIndustry), + mover: specialMachineryMover, + moverSpecified: getSpecified(specialMachineryMover), + type: specialMachineryType, + typeSpecified: getSpecified(specialMachineryType), + }, + }, + }; +} diff --git a/apps/web/config/schema/elt.ts b/apps/web/config/schema/elt.ts index b9369cf..a209314 100644 --- a/apps/web/config/schema/elt.ts +++ b/apps/web/config/schema/elt.ts @@ -17,6 +17,13 @@ export const RequestEltKaskoSchema = z.object({ SubjectType: z.number(), SubjectTypeSpecified: z.boolean(), }), + PUUs: z.array( + z.object({ + mark: z.string(), + model: z.string(), + modelSpecified: z.boolean(), + }) + ), STOA: z.string(), approvedDriving: z.number(), approvedDrivingSpecified: z.boolean(), @@ -57,7 +64,7 @@ export const RequestEltKaskoSchema = z.object({ selfIgnition: z.boolean(), selfIgnitionSpecified: z.boolean(), ssType: z.string(), - usageStart: z.string(), + usageStart: z.date(), vehicle: z.object({ category: z.string(), classification: z.string(), @@ -69,7 +76,9 @@ export const RequestEltKaskoSchema = z.object({ seatingCapacitySpecified: z.boolean(), vehicleUsage: z.number(), vehicleUsageSpecified: z.boolean(), + vin: z.string(), }), + vehicleDate: z.date().optional(), vehicleDateSpecified: z.boolean(), vehicleYear: z.number(), }), diff --git a/apps/web/graphql/crm.query.graphql b/apps/web/graphql/crm.query.graphql index ba15e13..a8ee224 100644 --- a/apps/web/graphql/crm.query.graphql +++ b/apps/web/graphql/crm.query.graphql @@ -348,6 +348,7 @@ query GetBrand($brandId: Uuid!) { evo_importer_reward_perc evo_importer_reward_rub evo_maximum_percentage_av + evo_brand_owner } } @@ -368,6 +369,10 @@ query GetModel($modelId: Uuid!) { evo_importer_reward_perc evo_importer_reward_rub evo_id + evo_vehicle_body_typeidData { + evo_id_elt + } + evo_running_gear } } diff --git a/apps/web/graphql/crm.types.ts b/apps/web/graphql/crm.types.ts index 47ab683..ecc7abb 100644 --- a/apps/web/graphql/crm.types.ts +++ b/apps/web/graphql/crm.types.ts @@ -300,7 +300,7 @@ export type GetBrandQueryVariables = Exact<{ }>; -export type GetBrandQuery = { __typename?: 'Query', evo_brand: { __typename?: 'evo_brand', evo_id: string | null, evo_importer_reward_perc: number | null, evo_importer_reward_rub: number | null, evo_maximum_percentage_av: number | null } | null }; +export type GetBrandQuery = { __typename?: 'Query', evo_brand: { __typename?: 'evo_brand', evo_id: string | null, evo_importer_reward_perc: number | null, evo_importer_reward_rub: number | null, evo_maximum_percentage_av: number | null, evo_brand_owner: number | null } | null }; export type GetModelsQueryVariables = Exact<{ brandId: Scalars['Uuid']; @@ -314,7 +314,7 @@ export type GetModelQueryVariables = Exact<{ }>; -export type GetModelQuery = { __typename?: 'Query', evo_model: { __typename?: 'evo_model', evo_importer_reward_perc: number | null, evo_importer_reward_rub: number | null, evo_id: string | null, evo_impairment_groupidData: { __typename?: 'evo_impairment_group', evo_name: string | null } | null } | null }; +export type GetModelQuery = { __typename?: 'Query', evo_model: { __typename?: 'evo_model', evo_importer_reward_perc: number | null, evo_importer_reward_rub: number | null, evo_id: string | null, evo_running_gear: number | null, evo_impairment_groupidData: { __typename?: 'evo_impairment_group', evo_name: string | null } | null, evo_vehicle_body_typeidData: { __typename?: 'evo_vehicle_body_typeGraphQL', evo_id_elt: string | null } | null } | null }; export type GetConfigurationsQueryVariables = Exact<{ modelId: Scalars['Uuid']; @@ -630,9 +630,9 @@ export const GetGpsModelsDocument = {"kind":"Document","definitions":[{"kind":"O export const GetLeaseObjectTypesDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"GetLeaseObjectTypes"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"evo_leasingobject_types"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"statecode"},"value":{"kind":"IntValue","value":"0"}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"label"},"name":{"kind":"Name","value":"evo_name"}},{"kind":"Field","alias":{"kind":"Name","value":"value"},"name":{"kind":"Name","value":"evo_leasingobject_typeid"}},{"kind":"Field","name":{"kind":"Name","value":"evo_leasingobject_typeid"}}]}}]}}]} as unknown as DocumentNode; export const GetLeaseObjectTypeDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"GetLeaseObjectType"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"leaseObjectTypeId"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"Uuid"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"evo_leasingobject_type"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"evo_leasingobject_typeid"},"value":{"kind":"Variable","name":{"kind":"Name","value":"leaseObjectTypeId"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"evo_vehicle_type"}},{"kind":"Field","name":{"kind":"Name","value":"evo_id"}},{"kind":"Field","name":{"kind":"Name","value":"evo_category"}},{"kind":"Field","name":{"kind":"Name","value":"evo_vehicle_type_tax"}},{"kind":"Field","name":{"kind":"Name","value":"evo_category_tr"}},{"kind":"Field","name":{"kind":"Name","value":"evo_expluatation_period1"}},{"kind":"Field","name":{"kind":"Name","value":"evo_expluatation_period2"}},{"kind":"Field","name":{"kind":"Name","value":"evo_depreciation_rate1"}},{"kind":"Field","name":{"kind":"Name","value":"evo_depreciation_rate2"}}]}}]}}]} as unknown as DocumentNode; export const GetBrandsDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"GetBrands"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"evo_brands"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"statecode"},"value":{"kind":"IntValue","value":"0"}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"label"},"name":{"kind":"Name","value":"evo_name"}},{"kind":"Field","alias":{"kind":"Name","value":"value"},"name":{"kind":"Name","value":"evo_brandid"}},{"kind":"Field","name":{"kind":"Name","value":"evo_brandid"}},{"kind":"Field","name":{"kind":"Name","value":"evo_vehicle_type"}}]}}]}}]} as unknown as DocumentNode; -export const GetBrandDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"GetBrand"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"brandId"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"Uuid"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"evo_brand"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"evo_brandid"},"value":{"kind":"Variable","name":{"kind":"Name","value":"brandId"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"evo_id"}},{"kind":"Field","name":{"kind":"Name","value":"evo_importer_reward_perc"}},{"kind":"Field","name":{"kind":"Name","value":"evo_importer_reward_rub"}},{"kind":"Field","name":{"kind":"Name","value":"evo_maximum_percentage_av"}}]}}]}}]} as unknown as DocumentNode; +export const GetBrandDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"GetBrand"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"brandId"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"Uuid"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"evo_brand"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"evo_brandid"},"value":{"kind":"Variable","name":{"kind":"Name","value":"brandId"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"evo_id"}},{"kind":"Field","name":{"kind":"Name","value":"evo_importer_reward_perc"}},{"kind":"Field","name":{"kind":"Name","value":"evo_importer_reward_rub"}},{"kind":"Field","name":{"kind":"Name","value":"evo_maximum_percentage_av"}},{"kind":"Field","name":{"kind":"Name","value":"evo_brand_owner"}}]}}]}}]} as unknown as DocumentNode; export const GetModelsDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"GetModels"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"brandId"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"Uuid"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"evo_models"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"statecode"},"value":{"kind":"IntValue","value":"0"}},{"kind":"Argument","name":{"kind":"Name","value":"evo_brandid"},"value":{"kind":"Variable","name":{"kind":"Name","value":"brandId"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"label"},"name":{"kind":"Name","value":"evo_name"}},{"kind":"Field","alias":{"kind":"Name","value":"value"},"name":{"kind":"Name","value":"evo_modelid"}},{"kind":"Field","name":{"kind":"Name","value":"evo_modelid"}},{"kind":"Field","name":{"kind":"Name","value":"evo_vehicle_type"}}]}}]}}]} as unknown as DocumentNode; -export const GetModelDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"GetModel"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"modelId"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"Uuid"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"evo_model"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"evo_modelid"},"value":{"kind":"Variable","name":{"kind":"Name","value":"modelId"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"evo_impairment_groupidData"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"evo_name"}}]}},{"kind":"Field","name":{"kind":"Name","value":"evo_importer_reward_perc"}},{"kind":"Field","name":{"kind":"Name","value":"evo_importer_reward_rub"}},{"kind":"Field","name":{"kind":"Name","value":"evo_id"}}]}}]}}]} as unknown as DocumentNode; +export const GetModelDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"GetModel"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"modelId"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"Uuid"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"evo_model"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"evo_modelid"},"value":{"kind":"Variable","name":{"kind":"Name","value":"modelId"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"evo_impairment_groupidData"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"evo_name"}}]}},{"kind":"Field","name":{"kind":"Name","value":"evo_importer_reward_perc"}},{"kind":"Field","name":{"kind":"Name","value":"evo_importer_reward_rub"}},{"kind":"Field","name":{"kind":"Name","value":"evo_id"}},{"kind":"Field","name":{"kind":"Name","value":"evo_vehicle_body_typeidData"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"evo_id_elt"}}]}},{"kind":"Field","name":{"kind":"Name","value":"evo_running_gear"}}]}}]}}]} as unknown as DocumentNode; export const GetConfigurationsDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"GetConfigurations"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"modelId"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"Uuid"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"evo_equipments"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"statecode"},"value":{"kind":"IntValue","value":"0"}},{"kind":"Argument","name":{"kind":"Name","value":"evo_modelid"},"value":{"kind":"Variable","name":{"kind":"Name","value":"modelId"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"label"},"name":{"kind":"Name","value":"evo_name"}},{"kind":"Field","alias":{"kind":"Name","value":"value"},"name":{"kind":"Name","value":"evo_equipmentid"}},{"kind":"Field","name":{"kind":"Name","value":"evo_start_production_year"}}]}}]}}]} as unknown as DocumentNode; export const GetConfigurationDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"GetConfiguration"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"configurationId"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"Uuid"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"evo_equipment"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"evo_equipmentid"},"value":{"kind":"Variable","name":{"kind":"Name","value":"configurationId"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"evo_impairment_groupidData"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"evo_name"}}]}}]}}]}}]} as unknown as DocumentNode; export const GetDealersDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"GetDealers"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"dealers"},"name":{"kind":"Name","value":"accounts"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"evo_account_type"},"value":{"kind":"ListValue","values":[{"kind":"IntValue","value":"100000001"}]}},{"kind":"Argument","name":{"kind":"Name","value":"statecode"},"value":{"kind":"IntValue","value":"0"}},{"kind":"Argument","name":{"kind":"Name","value":"evo_legal_form"},"value":{"kind":"IntValue","value":"100000001"}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"label"},"name":{"kind":"Name","value":"name"}},{"kind":"Field","alias":{"kind":"Name","value":"value"},"name":{"kind":"Name","value":"accountid"}},{"kind":"Field","name":{"kind":"Name","value":"accountid"}},{"kind":"Field","name":{"kind":"Name","value":"evo_supplier_financing_accept"}}]}}]}}]} as unknown as DocumentNode;