All files / lib/packages/shared-types/events capitated-initial.ts

100% Statements 5/5
100% Branches 0/0
100% Functions 1/1
100% Lines 3/3

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41          215x           62x                                                       215x  
import { z } from "zod";
 
import { attachmentArraySchema, attachmentArraySchemaOptional } from "../attachments";
import { initialSchema } from "./base-schema";
 
export const baseSchema = z.object({
  event: z.literal("capitated-initial").default("capitated-initial"),
  authority: z.string().default("1915(b)"),
  id: z
    .string()
    .min(1, { message: "Required" })
    .refine((id) => /^[A-Z]{2}-\d{4,5}\.R00\.00$/.test(id), {
      message:
        "The Initial Waiver Number must be in the format of SS-####.R00.00 or SS-#####.R00.00",
    }),
  proposedEffectiveDate: z.number(),
  attachments: z.object({
    bCapWaiverApplication: z.object({
      label: z.string().default("1915(b) Comprehensive (Capitated) Waiver Application Pre-print"),
      files: attachmentArraySchema(),
    }),
    bCapCostSpreadsheets: z.object({
      label: z
        .string()
        .default("1915(b) Comprehensive (Capitated) Waiver Cost Effectiveness Spreadsheets"),
      files: attachmentArraySchema(),
    }),
    tribalConsultation: z.object({
      label: z.string().default("Tribal Consultation"),
      files: attachmentArraySchemaOptional(),
    }),
    other: z.object({
      label: z.string().default("Other"),
      files: attachmentArraySchemaOptional(),
    }),
  }),
  additionalInformation: z.string().max(4000).nullable().default(null).optional(),
});
 
export const schema = baseSchema.merge(initialSchema);