import { RiskSchema } from 'config/schema/fingap';
import { KeysSchema, RowSchema } from 'config/schema/insurance';
import PaymentsSchema from 'config/schema/payments';
import ValuesSchema from 'config/schema/values';
import { z } from 'zod';

const { quote, recalcWithRevision } = ValuesSchema.shape;
export const GetQuoteDataInputSchema = z.object({
  values: z
    .object({
      quote: quote.unwrap(),
      recalcWithRevision,
    })
    .required(),
});
export type GetQuoteDataInput = z.infer<typeof GetQuoteDataInputSchema>;

export const GetQuoteDataOutputSchema = z.object({
  values: ValuesSchema,
  payments: PaymentsSchema,
  insurance: z
    .object({
      values: z.record(KeysSchema, RowSchema),
    })
    .required(),
  fingap: z
    .object({
      keys: z.array(RiskSchema.shape.key),
    })
    .optional(),
});
export type GetQuoteDataOutput = z.infer<typeof GetQuoteDataOutputSchema>;
