import { z } from 'zod'

export const SocialSchema = z.union([z.literal('Github'), z.literal('YouTube')])
export type Social = z.infer<typeof SocialSchema>

export const LanguageSchema = z.union([
  z.literal('Java'),
  z.literal('Rust'),
  z.literal('Go'),
  z.literal('Ruby'),
  z.literal('Kotlin'),
  z.literal('TypeScript'),
  z.literal('Python'),
])
export type Language = z.infer<typeof LanguageSchema>

export const TagSchema = z.union([
  z.literal('1.8'),
  z.literal('1.12'),
  z.literal('1.17'),
  z.literal('Paper'),
  z.literal('Bungee'),
  z.literal('Frontend'),
  z.literal('Backend'),
  z.literal('Fullstack'),
  z.literal('Archived'),
])
export type Tag = z.infer<typeof TagSchema>

export const CategorySchema = z.union([
  z.literal('Minecraft'),
  z.literal('Web'),
  z.literal('Discord'),
  z.literal('Misc'),
  z.literal('Unity'),
])
export type Category = z.infer<typeof CategorySchema>

export const ProjectSchema = z.object({
  name: z.string(),
  description: z.string(),
  category: CategorySchema,
  imageUrl: z.string(),
  socials: z.record(SocialSchema, z.string().url()).optional(),
  languages: z.array(LanguageSchema),
  tags: z.array(TagSchema),
})
export type Project = z.infer<typeof ProjectSchema>

export const projectsSchema = z.array(ProjectSchema)
