import { defineCollection, z } from "astro:content"

const postCollection = defineCollection({
  type: "content",
  schema: z.object({
    title: z.string(),
    description: z.string().optional(),
    publishedAt: z.date().optional(),
    category: z.enum(["news", "blog", "tutorial"]).optional(),
  }),
})

const pageCollection = defineCollection({
  type: "content",
  schema: z.object({
    title: z.string(),
    description: z.string().optional(),
  }),
})

const settingsCollection = defineCollection({
  type: "data",
  schema: z.object({
    siteName: z.string(),
    siteDescription: z.string(),
    language: z.enum(["th", "en", "th-en"]).default("th"),
  }),
})

export const collections = {
  posts: postCollection,
  pages: pageCollection,
  settings: settingsCollection,
}
