import { z } from "zod";

const weightField = z.coerce.number().int().min(1).max(5).optional().nullable();

export const customerSearchSchema = z.object({
  customerId: z.string().min(1, "Müşteri seçin"),
  listingType: z.enum(["satilik", "kiralik"]).optional().or(z.literal("")),
  propertyTypes: z.string().max(500).optional(),
  roomCounts: z.string().max(200).optional(),
  minPrice: z.coerce.number().min(0).optional().nullable(),
  maxPrice: z.coerce.number().min(0).optional().nullable(),
  minM2: z.coerce.number().min(0).optional().nullable(),
  maxM2: z.coerce.number().min(0).optional().nullable(),
  cities: z.string().max(500).optional(),
  districts: z.string().max(1000).optional(),
  isActive: z.boolean().default(true),
  notes: z.string().max(5000).optional(),
  priceWeight: weightField,
  m2Weight: weightField,
  locationWeight: weightField,
  roomCountWeight: weightField,
  propertyTypeWeight: weightField,
});

export type CustomerSearchFormValues = z.infer<typeof customerSearchSchema>;
