1 import { z } from 'zod';
3 const zUnixTime = z.number();
5 const zDefaultProtocolActual = z.object({
6 isDefault: z.boolean(),
7 wasChecked: z.boolean(),
9 export type DefaultProtocolActual = z.infer<typeof zDefaultProtocolActual>;
11 export const UNCHECKED_PROTOCOL: DefaultProtocolActual = {
16 const zDefaultProtocolStored = z.object({
17 shouldBeDefault: z.boolean(),
18 wasDefaultInPast: z.boolean(),
19 lastReport: z.object({
20 wasDefault: z.boolean(),
24 export type DefaultProtocolStored = z.infer<typeof zDefaultProtocolStored>;
26 export const zDefaultProtocol = zDefaultProtocolActual.merge(zDefaultProtocolStored);
28 export type DefaultProtocol = z.infer<typeof zDefaultProtocol>;
30 const zDefaultProtocolsStored = z.object({
31 mailto: zDefaultProtocolStored,
34 export type DefaultProtocolsStored = z.infer<typeof zDefaultProtocolsStored>;
35 export const parseDefaultProtocolsStored = (data: unknown): DefaultProtocolsStored =>
36 zDefaultProtocolsStored.parse(data);
38 export type PROTOCOLS = keyof DefaultProtocolsStored;