import { z } from 'zod';

export const onlinePlayerSchema = z.object({
  name: z.string(),
  uuid: z.string().uuid().optional(),
});

export const whitelistEntrySchema = z.object({
  uuid: z.string().uuid(),
  name: z.string(),
});

export const operatorEntrySchema = z.object({
  uuid: z.string().uuid(),
  name: z.string(),
  level: z.number().int().min(0).max(4).optional(),
  bypassesPlayerLimit: z.boolean().optional(),
});

export const playerListResponseSchema = z.object({
  online: z.array(onlinePlayerSchema),
  whitelist: z.array(whitelistEntrySchema),
  operators: z.array(operatorEntrySchema),
});

export type OnlinePlayer = z.infer<typeof onlinePlayerSchema>;
export type WhitelistEntry = z.infer<typeof whitelistEntrySchema>;
export type OperatorEntry = z.infer<typeof operatorEntrySchema>;
export type PlayerListResponse = z.infer<typeof playerListResponseSchema>;
