import { z } from 'zod'

export const deviceStatusSchema = z.enum(['active', 'inactive', 'banned'])

export const deviceSchema = z.object({
  id: z.union([z.string(), z.number()]),
  user_id: z.union([z.string(), z.number()]),
  application_id: z.union([z.string(), z.number()]),
  device_id: z.string(),
  device_name: z.string().optional().nullable(),
  device_type: z.string().optional().nullable(),
  status: deviceStatusSchema,
  online_sessions: z.number().optional(),
  created_at: z.string(),
  updated_at: z.string().optional(),
  user: z.object({
    id: z.union([z.string(), z.number()]),
    username: z.string(),
  }).optional().nullable(),
  application: z.object({
    id: z.union([z.string(), z.number()]),
    name: z.string(),
  }).optional().nullable(),
})

export type Device = z.infer<typeof deviceSchema>
export type DeviceStatus = z.infer<typeof deviceStatusSchema>
