import { z } from 'zod'

export const offerSchema = z.object({
  title:          z.string().min(1),
  description:    z.string().optional(),
  termsAndConds:  z.string().optional(),
  type:           z.enum(['PERCENTAGE', 'FIXED_AMOUNT', 'FREE_DAY', 'SPECIAL_RATE']),
  discountValue:  z.number().int().min(0),
  specialRate:    z.number().int().optional(),
  appliesToAll:   z.boolean().default(true),
  categories:     z.array(z.enum(['ECONOMY', 'COMPACT', 'MIDSIZE', 'FULLSIZE', 'SUV', 'LUXURY', 'VAN', 'TRUCK'])).default([]),
  minRentalDays:  z.number().int().optional(),
  maxRentalDays:  z.number().int().optional(),
  promoCode:      z.string().optional(),
  maxRedemptions: z.number().int().optional(),
  validFrom:      z.string().datetime(),
  validUntil:     z.string().datetime(),
  isActive:       z.boolean().default(true),
  isPublic:       z.boolean().default(true),
  isFeatured:     z.boolean().default(false),
  vehicleIds:     z.array(z.string()).default([]),
})

export const listQuerySchema = z.object({
  active: z.string().optional(),
  public: z.string().optional(),
})

export const idParamSchema = z.object({
  id: z.string().min(1),
})
