import { z } from "zod"

import { systemSchema } from "./system"

export const getMetaDataSchema = z.object({
  breadcrumbsTitle: z.string().optional(),
  title: z.string().optional(),
  description: z.string().optional(),
  imageConnection: z
    .object({
      edges: z.array(
        z.object({
          node: z.object({
            url: z.string(),
          }),
        })
      ),
    })
    .optional(),
})

export const page = z.object({
  web: z.object({
    seo_metadata: z.object({
      title: z.string().optional(),
      description: z.string().optional(),
      imageConnection: z
        .object({
          edges: z.array(
            z.object({
              node: z.object({
                url: z.string(),
              }),
            })
          ),
        })
        .optional(),
    }),
    breadcrumbs: z.object({
      title: z.string(),
    }),
  }),
  system: systemSchema,
})

export type Page = z.infer<typeof page>
