import { z } from 'zod';

export const leadListItemSchema = z.object({
  id: z.number(),
  fullName: z.string(),
  email: z.string().email(),
  phone: z.string().nullable().optional(),
  createdAt: z.string().optional(),
});

export type LeadListItem = z.infer<typeof leadListItemSchema>;

export const leadSchema = leadListItemSchema.extend({
  createdAt: z.string(),
});

export type Lead = z.infer<typeof leadSchema>;

export const leadPageSchema = z.object({
  items: z.array(leadListItemSchema),
  total: z.number(),
  limit: z.number(),
  offset: z.number(),
});

export type LeadPageResponse = z.infer<typeof leadPageSchema>;

export const leadCreatePayloadSchema = z.object({
  fullName: z.string().min(1),
  email: z.string().email(),
  phone: z.string().min(5).max(32).optional(),
});

export type LeadCreatePayload = z.infer<typeof leadCreatePayloadSchema>;

export const leadCreateResponseSchema = z.object({
  id: z.number(),
});

export type LeadCreateResponse = z.infer<typeof leadCreateResponseSchema>;

export const leadDeleteResponseSchema = z.object({
  deleted: z.boolean(),
});

export type LeadDeleteResponse = z.infer<typeof leadDeleteResponseSchema>;
