import { defineCollection, z } from 'astro:content';

const blogCollection = defineCollection({
  schema: ({ image }) => z.object({
    title: z.string(),
    date: z.date(),
    cover: image().refine((img) => img.width >= 720, {
      message: "Cover image must be at least 720 pixels wide!",
    }).optional(),
    links: z.array(z.array(z.string())).optional(),
    coverAlt: z.string().optional(),
    toc: z.boolean().optional(),
    description: z.string().optional(),
    icon: z.string().optional(),
    draft: z.boolean().optional(),
    featured: z.boolean().optional(),
    tags: z.array(z.string()).optional(),
    _layout: z.enum(['normal', 'transparent']).optional(),
  })
});

export const collections = {
  'blog': blogCollection,
  "projects": blogCollection,
  "photos": blogCollection,
};
