import { z } from "zod"

import { tempImageVaultAssetSchema } from "../../imageVault"
import { systemSchema } from "../../system"
import { buttonSchema } from "../utils/buttonLinkSchema"
import { linkConnectionRefsSchema } from "../utils/linkConnection"

import { CardsEnum } from "@/types/enums/cards"

export const loyaltyCardBlockSchema = z.object({
  __typename: z.literal(CardsEnum.LoyaltyCard),
  body_text: z.string().optional(),
  heading: z.string().optional().default(""),
  // JSON - ImageVault Image
  image: tempImageVaultAssetSchema,
  link: buttonSchema,
  system: systemSchema,
  title: z.string().optional(),
})

export const loyaltyCardBlockRefsSchema = z.object({
  __typename: z.literal(CardsEnum.LoyaltyCard),
  link: linkConnectionRefsSchema,
  system: systemSchema,
})
