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

const entry = z.object({
  title: z.string(),
  link: z.string().url(),
  date: z.string().transform((str) => new Date(str)),
  servant: z.string(),
  turns: z.string(),
  runner: z.string(),
})

const quest = z.object({
  questTitle: z.string(),
  description: z.string(),
  data: z.array(entry)
})

const info = z.object({
  title: z.string(),
  releaseDate: z.string().transform((str) => new Date(str)),
  shortdescription: z.string(),
  releaseNumber: z.number().default(1),
})

const taData = defineCollection({
  type: 'data',
  schema: z.object({
    info: info,
    quests: z.array(quest),
  }),
})

export const collections = {
  taInfoData: taData,
}
