import { z } from 'zod'

export const updateStrategySchema = z.enum(['optional', 'forced'])
export const updateMethodSchema = z.enum(['manual', 'hot', 'full'])
export const versionStatusSchema = z.enum(['active', 'superseded'])

export const versionSchema = z.object({
  id: z.number(),
  application_id: z.number(),
  application_name: z.string(),
  version: z.string(),
  description: z.string(),
  file_path: z.string(),
  file_size: z.number(),
  force_update: z.boolean(),
  update_strategy: updateStrategySchema,
  update_method: updateMethodSchema,
  status: versionStatusSchema,
  base_version_id: z.number().nullable(),
  changelog: z.string(),
  created_at: z.string(),
  updated_at: z.string(),
})

export type Version = z.infer<typeof versionSchema>
