285 lines
7.6 KiB
TypeScript

import { z } from 'zod';
export const RequestEltKaskoSchema = z.object({
companyId: z.string(),
params: z.object({
Insurer: z.object({
SubjectType: z.number(),
SubjectTypeSpecified: z.boolean(),
}),
Lessee: z.object({
INN: z.string(),
SubjectType: z.number(),
SubjectTypeSpecified: z.boolean(),
}),
OfficialDealer: z.boolean(),
OfficialDealerSpecified: z.boolean(),
Owner: 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(),
bankId: z.string(),
cost: z.number(),
currency: z.string(),
drivers: z.array(
z.object({
age: z.number(),
experience: z.number(),
sex: z.string(),
sexSpecified: z.boolean(),
})
),
driversCount: z.number(),
duration: z.number(),
franchise: z.number(),
franchiseSpecified: z.boolean(),
isNew: z.boolean(),
modification: z.object({
KPPTypeId: z.number(),
country: z.number(),
countrySpecified: z.boolean(),
engineType: z.string(),
engineVolume: z.number(),
engineVolumeSpecified: z.boolean(),
power: z.number(),
powerSpecified: z.boolean(),
}),
notConfirmedDamages: z.number(),
notConfirmedDamagesSpecified: z.boolean(),
notConfirmedGlassesDamages: z.number(),
notConfirmedGlassesDamagesSpecified: z.boolean(),
outsideRoads: z.boolean(),
outsideRoadsSpecified: z.boolean(),
payType: z.string(),
risk: z.number(),
selfIgnition: z.boolean(),
selfIgnitionSpecified: z.boolean(),
ssType: z.string(),
usageStart: z.date(),
vehicle: z.object({
category: z.string(),
classification: z.string(),
maxAllowedMass: z.number(),
maxAllowedMassSpecified: z.boolean(),
mileage: z.number(),
mileageSpecified: z.boolean(),
seatingCapacity: z.number(),
seatingCapacitySpecified: z.boolean(),
vehicleUsage: z.number(),
vehicleUsageSpecified: z.boolean(),
vin: z.string(),
}),
vehicleDate: z.date().optional(),
vehicleDateSpecified: z.boolean(),
vehicleYear: z.number(),
}),
preparams: z.object({
brandId: z.string(),
kladr: z.string(),
modelId: z.string(),
specialMachinery: z.object({
industry: z.number(),
industrySpecified: z.boolean(),
mover: z.number(),
moverSpecified: z.boolean(),
type: z.number(),
typeSpecified: z.boolean(),
}),
}),
});
export const ResultEltKaskoSchema = z.object({
calcInfo: z.null(),
comment: z.null(),
doSum: z.number(),
error: z.string(),
errorType: z.null(),
gapSum: z.number(),
goSum: z.number(),
insuranceCompanyFranchise: z.object({ id: z.string(), value: z.string() }),
insuranceCompanyGo: z.object({ id: z.string(), value: z.string() }),
isNeedInspection: z.string(),
kaskoSum: z.number(),
kbmOsago: z.null(),
message: z.string(),
nsSum: z.number(),
options: z.array(
z.union([
z.object({
id: z.string(),
name: z.string(),
values: z.array(z.object({ id: z.string(), name: z.string() })),
}),
z.object({
id: z.string(),
name: z.string(),
values: z.array(z.object({ id: z.string(), name: z.null() })),
}),
z.object({
id: z.string(),
name: z.string(),
values: z.array(z.object({ id: z.null(), name: z.null() })),
}),
])
),
paymentPeriods: z.array(
z.object({
date: z.string(),
doSum: z.number(),
doSumSpecified: z.boolean(),
duration: z.number(),
durationSpecified: z.boolean(),
franchiseSum: z.number(),
franchiseSumSpecified: z.boolean(),
gapSum: z.number(),
gapSumSpecified: z.boolean(),
goSum: z.number(),
goSumSpecified: z.boolean(),
id: z.null(),
kaskoSum: z.number(),
kaskoSumSpecified: z.boolean(),
name: z.null(),
nsSum: z.number(),
nsSumSpecified: z.boolean(),
num: z.number(),
numSpecified: z.boolean(),
premiumSum: z.number(),
premiumSumSpecified: z.boolean(),
rate: z.number(),
rateSpecified: z.boolean(),
})
),
policyNumber: z.null(),
premiumSum: z.number(),
product: z.string(),
productId: z.string(),
program: z.string(),
programCode: z.string(),
programId: z.string(),
requestId: z.string(),
skCalcId: z.string(),
totalFranchise: z.number(),
totalFranchiseSpecified: z.boolean(),
unicusGUID: z.string(),
});
export const RequestEltOsagoSchema = z.object({
companyId: z.string(),
params: z.object({
FullDriversInfo: z.array(z.object({ kbm: z.string() })),
carInfo: z.object({
mark: z.string(),
model: z.string(),
tsType: z.object({ category: z.string(), subCategory: z.string() }),
useWithTrailer: z.boolean(),
useWithTrailerSpecified: z.boolean(),
vehicle: z.object({
maxAllowedMass: z.number(),
maxAllowedMassSpecified: z.boolean(),
seatingCapacity: z.number(),
seatingCapacitySpecified: z.boolean(),
}),
vehiclePower: z.number(),
vehicleYear: z.string(),
}),
contractBeginDate: z.date(),
contractOptionId: z.number(),
contractStatusId: z.number(),
driversCount: z.number(),
duration: z.number(),
insurer: z.object({
INN: z.string(),
SubjectType: z.number(),
SubjectTypeSpecified: z.boolean(),
}),
insurerType: z.number(),
lessee: z.object({
SubjectType: z.number(),
SubjectTypeSpecified: z.boolean(),
inn: z.string(),
}),
owner: z.object({
JuridicalName: z.string(),
email: z.string(),
factAddress: z.object({
city: z.string(),
cityKladr: z.string(),
country: z.string(),
house: z.string(),
region: z.string(),
resident: z.number(),
street: z.string(),
}),
inn: z.string(),
kpp: z.string(),
ogrn: z.string(),
opf: z.number(),
opfSpecified: z.boolean(),
phone: z.string(),
registrationAddress: z.object({
city: z.string(),
cityKladr: z.string(),
country: z.string(),
house: z.string(),
region: z.string(),
resident: z.number(),
street: z.string(),
}),
subjectType: z.number(),
subjectTypeSpecified: z.boolean(),
}),
ownerType: z.number(),
tsToRegistrationPlace: z.number(),
}),
preparams: z.object({
brandId: z.string(),
kladr: z.string(),
modelId: z.string(),
}),
});
export const ResultEltOsagoSchema = z.object({
calcInfo: z.array(
z.object({
itemName: z.string(),
value: z.number(),
valueSpecified: z.boolean(),
})
),
error: z.string(),
fullDriversInfo: z.array(z.unknown()),
kbm: z.object({ class: z.number(), value: z.number() }),
message: z.string(),
numCalc: z.number(),
premiumSum: z.number(),
prevoiusKBM: z.object({ class: z.number(), value: z.number() }),
rsaRequestId: z.string(),
skCalcId: z.string(),
tb: z.number(),
});
export const RowSchema = z.object({
id: z.string(),
insuranceCondition: z.string().nullable(),
key: z.string(),
message: z.string().nullable(),
metodCalc: z.union([z.literal('CRM'), z.literal('ELT')]),
name: z.string(),
numCalc: z.string(),
requestId: z.string(),
skCalcId: z.string(),
status: z.string().nullable(),
sum: z.number(),
totalFranchise: z.number(),
});