import { z } from "zod"

import { BlocksEnums } from "@/types/enums/blocks"

export const essentialsSchema = z.object({
  essentials: z.object({
    title: z.string(),
    preamble: z.string().nullish(),
    items: z.array(
      z.object({
        label: z.string(),
        icon_identifier: z.string(),
        description: z.string().nullish(),
      })
    ),
  }),
})

export const essentialsBlockSchema = z
  .object({
    typename: z
      .literal(BlocksEnums.block.Essentials)
      .optional()
      .default(BlocksEnums.block.Essentials),
  })
  .merge(essentialsSchema)
