import { objectId } from '@jig-software/zod-bson';
import { z } from 'zod';
import { Preferences } from './Preferences';
import { Role } from './Role';

export const Staff = z.object({
  _id: objectId(),
  role: Role,
  rocketChatUsername: z.string().nullish(),
  nameEN: z.string(),
  nameZH: z.string(),
  hkId: z.string(),
  nickNames: z.array(z.string()).nullish(), // For "fuzzy" search.
  birthDate: z.date().nullish(),
  company: z.string().nullish(),
  department: z.string().nullish(),
  directReports: z.array(objectId()).nullish(),
  emails: z.array(z.string()).nullish(),
  onBoardedAt: z.date().nullish(),
  offBoardedAt: z.date().nullish(),
  preferences: Preferences,
  partTime: z.boolean().nullish(),
  createdAt: z.date(),
  updatedAt: z.date(),
});

export type Staff = z.infer<typeof Staff>;
