Kaizen
Browse modulesInsightsinsights/sharedSchemas and constants

Variable: reportScheduleConfigSchema

const reportScheduleConfigSchema: ZodDiscriminatedUnion<[ZodObject<{
  cadence: ZodLiteral<"daily">;
  format: ZodEnum<{
     csv: "csv";
     pdf: "pdf";
     xlsx: "xlsx";
  }>;
  recipients: ZodPipe<ZodArray<ZodString>, ZodTransform<string[], string[]>>;
  timeOfDay: ZodString;
  timezone: ZodString;
}, $strip>, ZodObject<{
  cadence: ZodLiteral<"weekly">;
  format: ZodEnum<{
     csv: "csv";
     pdf: "pdf";
     xlsx: "xlsx";
  }>;
  recipients: ZodPipe<ZodArray<ZodString>, ZodTransform<string[], string[]>>;
  timeOfDay: ZodString;
  timezone: ZodString;
  weekdays: ZodPipe<ZodArray<ZodNumber>, ZodTransform<number[], number[]>>;
}, $strip>, ZodObject<{
  cadence: ZodLiteral<"monthly">;
  dayOfMonth: ZodUnion<readonly [ZodNumber, ZodLiteral<"last">]>;
  format: ZodEnum<{
     csv: "csv";
     pdf: "pdf";
     xlsx: "xlsx";
  }>;
  recipients: ZodPipe<ZodArray<ZodString>, ZodTransform<string[], string[]>>;
  timeOfDay: ZodString;
  timezone: ZodString;
}, $strip>, ZodObject<{
  cadence: ZodLiteral<"custom">;
  cron: ZodString;
  format: ZodEnum<{
     csv: "csv";
     pdf: "pdf";
     xlsx: "xlsx";
  }>;
  recipients: ZodPipe<ZodArray<ZodString>, ZodTransform<string[], string[]>>;
  timezone: ZodString;
}, $strip>], "cadence">;

Defined in: shared/insights/schedule.ts:192

The schedule config, discriminated on cadence. Each branch carries exactly the timing fields its cadence needs — a weekly schedule has weekdays, a custom one has cron and no timeOfDay — so an impossible combination (weekly-with-a-cron, custom-with-weekdays) is unrepresentable rather than merely discouraged. The dialog switches its timing controls on the same discriminant.