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

export const FleetStatus = z.enum([
  'CONNECTED',
  'FAULT',
  'AUTO_DRIVING',
  'ASSISTED_DRIVING',
  'TASKING',
  'PLATOON',
  'CHARGIN',
  'BUSY',
  'WARNING',
  'NAVIGATE',
  'DOWN',
]);
export type FleetStatus = z.infer<typeof FleetStatus>;

export const FleetOccupation = z.object({
  workId: z.string(),
  startAt: z.date(),
  endAt: z.date(),
});
export type FleetOccupation = z.infer<typeof FleetOccupation>;

export const Fleet = z.object({
  _id: objectId(),
  fleetId: z.string(),
  deviceType: z.string(),
  status: z.array(FleetStatus),
  occupation: z.array(FleetOccupation),
  OBUId: z.string(),
  remark: z.string().optional(),
  createdAt: z.date(),
  updatedAt: z.date(),
});
export type Fleet = z.infer<typeof Fleet>;
