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

const peopleCollection = defineCollection({
  schema: z.object({
    name: z.string(),
    title: z.string(),
    img: z.string(),
    organization: z.string().optional(),
    email: z.string().optional(),
    linkedin: z.string().optional(),
    twitter: z.string().optional(),
    instagram: z.string().optional(),
    facebook: z.string().optional(),
    mastodon: z.string().optional(),
  }),
});

const mapCollection = defineCollection({
  schema: z.object({
    name: z.string(),
    description: z.string(),
    website: z.string(),
    lat: z.number(),
    lng: z.number(),
    image: z.string(),
    category: z.string(),
    relationStatus: z.string(),
    tags: z.array(z.object({ displayName: z.string(), color: z.string() })),
  }),
});

const socialsCollection = defineCollection({
  schema: z.object({
    alt: z.string(),
    type: z.string(),
    href: z.string(),
  }),
});

const toolbarCollection = defineCollection({
  schema: z.object({
    title: z.string(),
    icon: z.string(),
    target: z.string(),
    onlyDesktop: z.boolean().optional(),
    order: z.number()
  }),
});

const footerLogosCollection = defineCollection({
  type: "content",
  schema: z.object({
    img: z.string(),
    href: z.string().optional(),
    alt: z.string().optional(),
    order: z.number().optional()
  }),
});

export const collections = {
  people: peopleCollection,
  map: mapCollection,
  socials: socialsCollection,
  toolbar: toolbarCollection,
  footerLogos: footerLogosCollection
};