import { z } from 'zod'
import type { Device } from '~/models/device'

const DeviceSchema = z.object({
  code: z.string({ required_error: 'Kode harus diisi' }).min(1, 'Kode minimum 1 karakter'),
  name: z.string({ required_error: 'Nama harus diisi' }).min(1, 'Nama minimum 1 karakter'),
  uom_code: z.string({ required_error: 'Kode unit harus diisi' }).min(1, 'Kode unit harus diisi'),
})

type DeviceFormData = z.infer<typeof DeviceSchema> & Partial<Device>

export { DeviceSchema }
export type { DeviceFormData }
