import { z } from "zod";

export const dealSchema = z.object({
  propertyId: z.string().optional(),
  customerId: z.string().optional(),
  propertyTitle: z.string().max(200).optional(),
  type: z.enum(["satis", "kiralama"]),
  salePrice: z.coerce.number().positive("Satış fiyatı girilmeli"),
  commissionRate: z.coerce
    .number()
    .min(0)
    .max(100, "Komisyon oranı 0-100 arasında olmalı"),
  commissionAmount: z.coerce.number().min(0),
  officeSharePercent: z.coerce.number().min(0).max(100).optional(),
  agentSharePercent: z.coerce.number().min(0).max(100).optional(),
  referralName: z.string().max(200).optional(),
  referralPhone: z.string().max(30).optional(),
  referralPercent: z.coerce.number().min(0).max(100).optional(),
  closingDate: z.string().optional(),
  notes: z.string().max(1000).optional(),
});

export type DealFormValues = z.infer<typeof dealSchema>;
