import { z } from 'zod'

export const updateStrategySchema = z.enum(['optional', 'forced'])
export const updateTypeSchema = z.enum(['full', 'patch'])
export const updateMethodSchema = z.enum(['auto', 'manual'])
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(),
  update_strategy: updateStrategySchema,
  update_type: updateTypeSchema,
  update_method: updateMethodSchema,
  status: versionStatusSchema,
  changelog: z.string(),
  created_at: z.string(),
  updated_at: z.string(),
})

export type Version = z.infer<typeof versionSchema>
