/*
 * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
 */

import * as z from "zod";
import { remap as remap$ } from "../../lib/primitives.js";
import { safeParse } from "../../lib/schemas.js";
import { ClosedEnum } from "../../types/enums.js";
import { Result as SafeParseResult } from "../../types/fp.js";
import { SDKValidationError } from "../errors/sdkvalidationerror.js";
import {
  TagSchema,
  TagSchema$inboundSchema,
  TagSchema$Outbound,
  TagSchema$outboundSchema,
} from "./tagschema.js";

export const LeadCreatedEventEvent = {
  LeadCreated: "lead.created",
} as const;
export type LeadCreatedEventEvent = ClosedEnum<typeof LeadCreatedEventEvent>;

export type LeadCreatedEventDataLink = {
  /**
   * The unique ID of the short link.
   */
  id: string;
  /**
   * The domain of the short link. If not provided, the primary domain for the workspace will be used (or `dub.sh` if the workspace has no domains).
   */
  domain: string;
  /**
   * The short link slug. If not provided, a random 7-character slug will be generated.
   */
  key: string;
  /**
   * The full URL of the short link, including the https protocol (e.g. `https://dub.sh/try`).
   */
  shortLink: string;
  /**
   * The ID of the program the short link is associated with.
   */
  programId: string | null;
};

export type LeadCreatedEventPartner = {
  id: string;
  name: string;
  email: string;
  image?: string | null | undefined;
};

export const LeadCreatedEventType = {
  Percentage: "percentage",
  Flat: "flat",
} as const;
export type LeadCreatedEventType = ClosedEnum<typeof LeadCreatedEventType>;

export const LeadCreatedEventInterval = {
  Month: "month",
  Year: "year",
} as const;
export type LeadCreatedEventInterval = ClosedEnum<
  typeof LeadCreatedEventInterval
>;

export type LeadCreatedEventDiscount = {
  id: string;
  couponId: string | null;
  couponTestId: string | null;
  amount: number;
  type: LeadCreatedEventType;
  duration: number | null;
  interval: LeadCreatedEventInterval | null;
};

export type LeadCreatedEventCustomer = {
  /**
   * The unique identifier of the customer in Dub.
   */
  id: string;
  /**
   * Unique identifier for the customer in the client's app.
   */
  externalId: string;
  /**
   * Name of the customer.
   */
  name: string;
  /**
   * Email of the customer.
   */
  email?: string | null | undefined;
  /**
   * Avatar URL of the customer.
   */
  avatar?: string | null | undefined;
  /**
   * Country of the customer.
   */
  country?: string | null | undefined;
  /**
   * The date the customer was created.
   */
  createdAt: string;
  link?: LeadCreatedEventDataLink | null | undefined;
  partner?: LeadCreatedEventPartner | null | undefined;
  discount?: LeadCreatedEventDiscount | null | undefined;
};

export type LeadCreatedEventClick = {
  id: string;
  url: string;
  country: string;
  city: string;
  region: string;
  continent: string;
  device: string;
  browser: string;
  os: string;
  referer: string;
  refererUrl: string;
  qr?: boolean | undefined;
  ip: string;
};

/**
 * Geo targeting information for the short link in JSON format `{[COUNTRY]: https://example.com }`. Learn more: https://d.to/geo
 */
export type LeadCreatedEventGeo = {
  af?: string | undefined;
  al?: string | undefined;
  dz?: string | undefined;
  as?: string | undefined;
  ad?: string | undefined;
  ao?: string | undefined;
  ai?: string | undefined;
  aq?: string | undefined;
  ag?: string | undefined;
  ar?: string | undefined;
  am?: string | undefined;
  aw?: string | undefined;
  au?: string | undefined;
  at?: string | undefined;
  az?: string | undefined;
  bs?: string | undefined;
  bh?: string | undefined;
  bd?: string | undefined;
  bb?: string | undefined;
  by?: string | undefined;
  be?: string | undefined;
  bz?: string | undefined;
  bj?: string | undefined;
  bm?: string | undefined;
  bt?: string | undefined;
  bo?: string | undefined;
  ba?: string | undefined;
  bw?: string | undefined;
  bv?: string | undefined;
  br?: string | undefined;
  io?: string | undefined;
  bn?: string | undefined;
  bg?: string | undefined;
  bf?: string | undefined;
  bi?: string | undefined;
  kh?: string | undefined;
  cm?: string | undefined;
  ca?: string | undefined;
  cv?: string | undefined;
  ky?: string | undefined;
  cf?: string | undefined;
  td?: string | undefined;
  cl?: string | undefined;
  cn?: string | undefined;
  cx?: string | undefined;
  cc?: string | undefined;
  co?: string | undefined;
  km?: string | undefined;
  cg?: string | undefined;
  cd?: string | undefined;
  ck?: string | undefined;
  cr?: string | undefined;
  ci?: string | undefined;
  hr?: string | undefined;
  cu?: string | undefined;
  cy?: string | undefined;
  cz?: string | undefined;
  dk?: string | undefined;
  dj?: string | undefined;
  dm?: string | undefined;
  do?: string | undefined;
  ec?: string | undefined;
  eg?: string | undefined;
  sv?: string | undefined;
  gq?: string | undefined;
  er?: string | undefined;
  ee?: string | undefined;
  et?: string | undefined;
  fk?: string | undefined;
  fo?: string | undefined;
  fj?: string | undefined;
  fi?: string | undefined;
  fr?: string | undefined;
  gf?: string | undefined;
  pf?: string | undefined;
  tf?: string | undefined;
  ga?: string | undefined;
  gm?: string | undefined;
  ge?: string | undefined;
  de?: string | undefined;
  gh?: string | undefined;
  gi?: string | undefined;
  gr?: string | undefined;
  gl?: string | undefined;
  gd?: string | undefined;
  gp?: string | undefined;
  gu?: string | undefined;
  gt?: string | undefined;
  gn?: string | undefined;
  gw?: string | undefined;
  gy?: string | undefined;
  ht?: string | undefined;
  hm?: string | undefined;
  va?: string | undefined;
  hn?: string | undefined;
  hk?: string | undefined;
  hu?: string | undefined;
  is?: string | undefined;
  in?: string | undefined;
  id?: string | undefined;
  ir?: string | undefined;
  iq?: string | undefined;
  ie?: string | undefined;
  il?: string | undefined;
  it?: string | undefined;
  jm?: string | undefined;
  jp?: string | undefined;
  jo?: string | undefined;
  kz?: string | undefined;
  ke?: string | undefined;
  ki?: string | undefined;
  kp?: string | undefined;
  kr?: string | undefined;
  kw?: string | undefined;
  kg?: string | undefined;
  la?: string | undefined;
  lv?: string | undefined;
  lb?: string | undefined;
  ls?: string | undefined;
  lr?: string | undefined;
  ly?: string | undefined;
  li?: string | undefined;
  lt?: string | undefined;
  lu?: string | undefined;
  mo?: string | undefined;
  mg?: string | undefined;
  mw?: string | undefined;
  my?: string | undefined;
  mv?: string | undefined;
  ml?: string | undefined;
  mt?: string | undefined;
  mh?: string | undefined;
  mq?: string | undefined;
  mr?: string | undefined;
  mu?: string | undefined;
  yt?: string | undefined;
  mx?: string | undefined;
  fm?: string | undefined;
  md?: string | undefined;
  mc?: string | undefined;
  mn?: string | undefined;
  ms?: string | undefined;
  ma?: string | undefined;
  mz?: string | undefined;
  mm?: string | undefined;
  na?: string | undefined;
  nr?: string | undefined;
  np?: string | undefined;
  nl?: string | undefined;
  nc?: string | undefined;
  nz?: string | undefined;
  ni?: string | undefined;
  ne?: string | undefined;
  ng?: string | undefined;
  nu?: string | undefined;
  nf?: string | undefined;
  mk?: string | undefined;
  mp?: string | undefined;
  no?: string | undefined;
  om?: string | undefined;
  pk?: string | undefined;
  pw?: string | undefined;
  ps?: string | undefined;
  pa?: string | undefined;
  pg?: string | undefined;
  py?: string | undefined;
  pe?: string | undefined;
  ph?: string | undefined;
  pn?: string | undefined;
  pl?: string | undefined;
  pt?: string | undefined;
  pr?: string | undefined;
  qa?: string | undefined;
  re?: string | undefined;
  ro?: string | undefined;
  ru?: string | undefined;
  rw?: string | undefined;
  sh?: string | undefined;
  kn?: string | undefined;
  lc?: string | undefined;
  pm?: string | undefined;
  vc?: string | undefined;
  ws?: string | undefined;
  sm?: string | undefined;
  st?: string | undefined;
  sa?: string | undefined;
  sn?: string | undefined;
  sc?: string | undefined;
  sl?: string | undefined;
  sg?: string | undefined;
  sk?: string | undefined;
  si?: string | undefined;
  sb?: string | undefined;
  so?: string | undefined;
  za?: string | undefined;
  gs?: string | undefined;
  es?: string | undefined;
  lk?: string | undefined;
  sd?: string | undefined;
  sr?: string | undefined;
  sj?: string | undefined;
  sz?: string | undefined;
  se?: string | undefined;
  ch?: string | undefined;
  sy?: string | undefined;
  tw?: string | undefined;
  tj?: string | undefined;
  tz?: string | undefined;
  th?: string | undefined;
  tl?: string | undefined;
  tg?: string | undefined;
  tk?: string | undefined;
  to?: string | undefined;
  tt?: string | undefined;
  tn?: string | undefined;
  tr?: string | undefined;
  tm?: string | undefined;
  tc?: string | undefined;
  tv?: string | undefined;
  ug?: string | undefined;
  ua?: string | undefined;
  ae?: string | undefined;
  gb?: string | undefined;
  us?: string | undefined;
  um?: string | undefined;
  uy?: string | undefined;
  uz?: string | undefined;
  vu?: string | undefined;
  ve?: string | undefined;
  vn?: string | undefined;
  vg?: string | undefined;
  vi?: string | undefined;
  wf?: string | undefined;
  eh?: string | undefined;
  ye?: string | undefined;
  zm?: string | undefined;
  zw?: string | undefined;
  ax?: string | undefined;
  bq?: string | undefined;
  cw?: string | undefined;
  gg?: string | undefined;
  im?: string | undefined;
  je?: string | undefined;
  me?: string | undefined;
  bl?: string | undefined;
  mf?: string | undefined;
  rs?: string | undefined;
  sx?: string | undefined;
  ss?: string | undefined;
  xk?: string | undefined;
};

export type LeadCreatedEventLink = {
  /**
   * The unique ID of the short link.
   */
  id: string;
  /**
   * The domain of the short link. If not provided, the primary domain for the workspace will be used (or `dub.sh` if the workspace has no domains).
   */
  domain: string;
  /**
   * The short link slug. If not provided, a random 7-character slug will be generated.
   */
  key: string;
  url: string;
  trackConversion?: boolean | undefined;
  /**
   * The ID of the link in your database. If set, it can be used to identify the link in future API requests (must be prefixed with 'ext_' when passed as a query parameter). This key is unique across your workspace.
   */
  externalId: string | null;
  /**
   * The ID of the tenant that created the link inside your system. If set, it can be used to fetch all links for a tenant.
   */
  tenantId: string | null;
  archived?: boolean | undefined;
  expiresAt: string;
  expiredUrl: string | null;
  /**
   * The password required to access the destination URL of the short link.
   */
  password: string | null;
  proxy?: boolean | undefined;
  /**
   * The title of the short link generated via `api.dub.co/metatags`. Will be used for Custom Social Media Cards if `proxy` is true.
   */
  title: string | null;
  /**
   * The description of the short link generated via `api.dub.co/metatags`. Will be used for Custom Social Media Cards if `proxy` is true.
   */
  description: string | null;
  /**
   * The image of the short link generated via `api.dub.co/metatags`. Will be used for Custom Social Media Cards if `proxy` is true.
   */
  image: string | null;
  /**
   * The custom link preview video (og:video). Will be used for Custom Social Media Cards if `proxy` is true. Learn more: https://d.to/og
   */
  video: string | null;
  rewrite?: boolean | undefined;
  doIndex?: boolean | undefined;
  /**
   * The iOS destination URL for the short link for iOS device targeting.
   */
  ios: string | null;
  /**
   * The Android destination URL for the short link for Android device targeting.
   */
  android: string | null;
  /**
   * Geo targeting information for the short link in JSON format `{[COUNTRY]: https://example.com }`. Learn more: https://d.to/geo
   */
  geo: LeadCreatedEventGeo | null;
  publicStats?: boolean | undefined;
  /**
   * The unique ID of the tag assigned to the short link. This field is deprecated – use `tags` instead.
   *
   * @deprecated field: This will be removed in a future release, please migrate away from it as soon as possible.
   */
  tagId: string | null;
  /**
   * The tags assigned to the short link.
   */
  tags: Array<TagSchema> | null;
  /**
   * The IDs of the webhooks that the short link is associated with.
   */
  webhookIds: Array<string>;
  /**
   * The comments for the short link.
   */
  comments: string | null;
  /**
   * The full URL of the short link, including the https protocol (e.g. `https://dub.sh/try`).
   */
  shortLink: string;
  /**
   * The full URL of the QR code for the short link (e.g. `https://api.dub.co/qr?url=https://dub.sh/try`).
   */
  qrCode: string;
  /**
   * The UTM source of the short link.
   */
  utmSource: string | null;
  /**
   * The UTM medium of the short link.
   */
  utmMedium: string | null;
  /**
   * The UTM campaign of the short link.
   */
  utmCampaign: string | null;
  /**
   * The UTM term of the short link.
   */
  utmTerm: string | null;
  /**
   * The UTM content of the short link.
   */
  utmContent: string | null;
  userId: string | null;
  /**
   * The workspace ID of the short link.
   */
  workspaceId: string;
  /**
   * The number of clicks on the short link.
   */
  clicks?: number | undefined;
  lastClicked: string;
  /**
   * The number of leads the short links has generated.
   */
  leads?: number | undefined;
  /**
   * The number of sales the short links has generated.
   */
  sales?: number | undefined;
  /**
   * The total dollar amount of sales the short links has generated (in cents).
   */
  saleAmount?: number | undefined;
  createdAt: string;
  updatedAt: string;
  /**
   * The project ID of the short link. This field is deprecated – use `workspaceId` instead.
   *
   * @deprecated field: This will be removed in a future release, please migrate away from it as soon as possible.
   */
  projectId: string;
  /**
   * The ID of the program the short link is associated with.
   */
  programId: string | null;
};

export type LeadCreatedEventData = {
  eventName: string;
  customer: LeadCreatedEventCustomer;
  click: LeadCreatedEventClick;
  link: LeadCreatedEventLink;
};

/**
 * Triggered when a lead is created.
 */
export type LeadCreatedEvent = {
  id: string;
  event: LeadCreatedEventEvent;
  createdAt: string;
  data: LeadCreatedEventData;
};

/** @internal */
export const LeadCreatedEventEvent$inboundSchema: z.ZodNativeEnum<
  typeof LeadCreatedEventEvent
> = z.nativeEnum(LeadCreatedEventEvent);

/** @internal */
export const LeadCreatedEventEvent$outboundSchema: z.ZodNativeEnum<
  typeof LeadCreatedEventEvent
> = LeadCreatedEventEvent$inboundSchema;

/**
 * @internal
 * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
 */
export namespace LeadCreatedEventEvent$ {
  /** @deprecated use `LeadCreatedEventEvent$inboundSchema` instead. */
  export const inboundSchema = LeadCreatedEventEvent$inboundSchema;
  /** @deprecated use `LeadCreatedEventEvent$outboundSchema` instead. */
  export const outboundSchema = LeadCreatedEventEvent$outboundSchema;
}

/** @internal */
export const LeadCreatedEventDataLink$inboundSchema: z.ZodType<
  LeadCreatedEventDataLink,
  z.ZodTypeDef,
  unknown
> = z.object({
  id: z.string(),
  domain: z.string(),
  key: z.string(),
  shortLink: z.string(),
  programId: z.nullable(z.string()),
});

/** @internal */
export type LeadCreatedEventDataLink$Outbound = {
  id: string;
  domain: string;
  key: string;
  shortLink: string;
  programId: string | null;
};

/** @internal */
export const LeadCreatedEventDataLink$outboundSchema: z.ZodType<
  LeadCreatedEventDataLink$Outbound,
  z.ZodTypeDef,
  LeadCreatedEventDataLink
> = z.object({
  id: z.string(),
  domain: z.string(),
  key: z.string(),
  shortLink: z.string(),
  programId: z.nullable(z.string()),
});

/**
 * @internal
 * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
 */
export namespace LeadCreatedEventDataLink$ {
  /** @deprecated use `LeadCreatedEventDataLink$inboundSchema` instead. */
  export const inboundSchema = LeadCreatedEventDataLink$inboundSchema;
  /** @deprecated use `LeadCreatedEventDataLink$outboundSchema` instead. */
  export const outboundSchema = LeadCreatedEventDataLink$outboundSchema;
  /** @deprecated use `LeadCreatedEventDataLink$Outbound` instead. */
  export type Outbound = LeadCreatedEventDataLink$Outbound;
}

export function leadCreatedEventDataLinkToJSON(
  leadCreatedEventDataLink: LeadCreatedEventDataLink,
): string {
  return JSON.stringify(
    LeadCreatedEventDataLink$outboundSchema.parse(leadCreatedEventDataLink),
  );
}

export function leadCreatedEventDataLinkFromJSON(
  jsonString: string,
): SafeParseResult<LeadCreatedEventDataLink, SDKValidationError> {
  return safeParse(
    jsonString,
    (x) => LeadCreatedEventDataLink$inboundSchema.parse(JSON.parse(x)),
    `Failed to parse 'LeadCreatedEventDataLink' from JSON`,
  );
}

/** @internal */
export const LeadCreatedEventPartner$inboundSchema: z.ZodType<
  LeadCreatedEventPartner,
  z.ZodTypeDef,
  unknown
> = z.object({
  id: z.string(),
  name: z.string(),
  email: z.string(),
  image: z.nullable(z.string()).optional(),
});

/** @internal */
export type LeadCreatedEventPartner$Outbound = {
  id: string;
  name: string;
  email: string;
  image?: string | null | undefined;
};

/** @internal */
export const LeadCreatedEventPartner$outboundSchema: z.ZodType<
  LeadCreatedEventPartner$Outbound,
  z.ZodTypeDef,
  LeadCreatedEventPartner
> = z.object({
  id: z.string(),
  name: z.string(),
  email: z.string(),
  image: z.nullable(z.string()).optional(),
});

/**
 * @internal
 * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
 */
export namespace LeadCreatedEventPartner$ {
  /** @deprecated use `LeadCreatedEventPartner$inboundSchema` instead. */
  export const inboundSchema = LeadCreatedEventPartner$inboundSchema;
  /** @deprecated use `LeadCreatedEventPartner$outboundSchema` instead. */
  export const outboundSchema = LeadCreatedEventPartner$outboundSchema;
  /** @deprecated use `LeadCreatedEventPartner$Outbound` instead. */
  export type Outbound = LeadCreatedEventPartner$Outbound;
}

export function leadCreatedEventPartnerToJSON(
  leadCreatedEventPartner: LeadCreatedEventPartner,
): string {
  return JSON.stringify(
    LeadCreatedEventPartner$outboundSchema.parse(leadCreatedEventPartner),
  );
}

export function leadCreatedEventPartnerFromJSON(
  jsonString: string,
): SafeParseResult<LeadCreatedEventPartner, SDKValidationError> {
  return safeParse(
    jsonString,
    (x) => LeadCreatedEventPartner$inboundSchema.parse(JSON.parse(x)),
    `Failed to parse 'LeadCreatedEventPartner' from JSON`,
  );
}

/** @internal */
export const LeadCreatedEventType$inboundSchema: z.ZodNativeEnum<
  typeof LeadCreatedEventType
> = z.nativeEnum(LeadCreatedEventType);

/** @internal */
export const LeadCreatedEventType$outboundSchema: z.ZodNativeEnum<
  typeof LeadCreatedEventType
> = LeadCreatedEventType$inboundSchema;

/**
 * @internal
 * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
 */
export namespace LeadCreatedEventType$ {
  /** @deprecated use `LeadCreatedEventType$inboundSchema` instead. */
  export const inboundSchema = LeadCreatedEventType$inboundSchema;
  /** @deprecated use `LeadCreatedEventType$outboundSchema` instead. */
  export const outboundSchema = LeadCreatedEventType$outboundSchema;
}

/** @internal */
export const LeadCreatedEventInterval$inboundSchema: z.ZodNativeEnum<
  typeof LeadCreatedEventInterval
> = z.nativeEnum(LeadCreatedEventInterval);

/** @internal */
export const LeadCreatedEventInterval$outboundSchema: z.ZodNativeEnum<
  typeof LeadCreatedEventInterval
> = LeadCreatedEventInterval$inboundSchema;

/**
 * @internal
 * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
 */
export namespace LeadCreatedEventInterval$ {
  /** @deprecated use `LeadCreatedEventInterval$inboundSchema` instead. */
  export const inboundSchema = LeadCreatedEventInterval$inboundSchema;
  /** @deprecated use `LeadCreatedEventInterval$outboundSchema` instead. */
  export const outboundSchema = LeadCreatedEventInterval$outboundSchema;
}

/** @internal */
export const LeadCreatedEventDiscount$inboundSchema: z.ZodType<
  LeadCreatedEventDiscount,
  z.ZodTypeDef,
  unknown
> = z.object({
  id: z.string(),
  couponId: z.nullable(z.string()),
  couponTestId: z.nullable(z.string()),
  amount: z.number(),
  type: LeadCreatedEventType$inboundSchema,
  duration: z.nullable(z.number()),
  interval: z.nullable(LeadCreatedEventInterval$inboundSchema),
});

/** @internal */
export type LeadCreatedEventDiscount$Outbound = {
  id: string;
  couponId: string | null;
  couponTestId: string | null;
  amount: number;
  type: string;
  duration: number | null;
  interval: string | null;
};

/** @internal */
export const LeadCreatedEventDiscount$outboundSchema: z.ZodType<
  LeadCreatedEventDiscount$Outbound,
  z.ZodTypeDef,
  LeadCreatedEventDiscount
> = z.object({
  id: z.string(),
  couponId: z.nullable(z.string()),
  couponTestId: z.nullable(z.string()),
  amount: z.number(),
  type: LeadCreatedEventType$outboundSchema,
  duration: z.nullable(z.number()),
  interval: z.nullable(LeadCreatedEventInterval$outboundSchema),
});

/**
 * @internal
 * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
 */
export namespace LeadCreatedEventDiscount$ {
  /** @deprecated use `LeadCreatedEventDiscount$inboundSchema` instead. */
  export const inboundSchema = LeadCreatedEventDiscount$inboundSchema;
  /** @deprecated use `LeadCreatedEventDiscount$outboundSchema` instead. */
  export const outboundSchema = LeadCreatedEventDiscount$outboundSchema;
  /** @deprecated use `LeadCreatedEventDiscount$Outbound` instead. */
  export type Outbound = LeadCreatedEventDiscount$Outbound;
}

export function leadCreatedEventDiscountToJSON(
  leadCreatedEventDiscount: LeadCreatedEventDiscount,
): string {
  return JSON.stringify(
    LeadCreatedEventDiscount$outboundSchema.parse(leadCreatedEventDiscount),
  );
}

export function leadCreatedEventDiscountFromJSON(
  jsonString: string,
): SafeParseResult<LeadCreatedEventDiscount, SDKValidationError> {
  return safeParse(
    jsonString,
    (x) => LeadCreatedEventDiscount$inboundSchema.parse(JSON.parse(x)),
    `Failed to parse 'LeadCreatedEventDiscount' from JSON`,
  );
}

/** @internal */
export const LeadCreatedEventCustomer$inboundSchema: z.ZodType<
  LeadCreatedEventCustomer,
  z.ZodTypeDef,
  unknown
> = z.object({
  id: z.string(),
  externalId: z.string(),
  name: z.string(),
  email: z.nullable(z.string()).optional(),
  avatar: z.nullable(z.string()).optional(),
  country: z.nullable(z.string()).optional(),
  createdAt: z.string(),
  link: z.nullable(z.lazy(() => LeadCreatedEventDataLink$inboundSchema))
    .optional(),
  partner: z.nullable(z.lazy(() => LeadCreatedEventPartner$inboundSchema))
    .optional(),
  discount: z.nullable(z.lazy(() => LeadCreatedEventDiscount$inboundSchema))
    .optional(),
});

/** @internal */
export type LeadCreatedEventCustomer$Outbound = {
  id: string;
  externalId: string;
  name: string;
  email?: string | null | undefined;
  avatar?: string | null | undefined;
  country?: string | null | undefined;
  createdAt: string;
  link?: LeadCreatedEventDataLink$Outbound | null | undefined;
  partner?: LeadCreatedEventPartner$Outbound | null | undefined;
  discount?: LeadCreatedEventDiscount$Outbound | null | undefined;
};

/** @internal */
export const LeadCreatedEventCustomer$outboundSchema: z.ZodType<
  LeadCreatedEventCustomer$Outbound,
  z.ZodTypeDef,
  LeadCreatedEventCustomer
> = z.object({
  id: z.string(),
  externalId: z.string(),
  name: z.string(),
  email: z.nullable(z.string()).optional(),
  avatar: z.nullable(z.string()).optional(),
  country: z.nullable(z.string()).optional(),
  createdAt: z.string(),
  link: z.nullable(z.lazy(() => LeadCreatedEventDataLink$outboundSchema))
    .optional(),
  partner: z.nullable(z.lazy(() => LeadCreatedEventPartner$outboundSchema))
    .optional(),
  discount: z.nullable(z.lazy(() => LeadCreatedEventDiscount$outboundSchema))
    .optional(),
});

/**
 * @internal
 * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
 */
export namespace LeadCreatedEventCustomer$ {
  /** @deprecated use `LeadCreatedEventCustomer$inboundSchema` instead. */
  export const inboundSchema = LeadCreatedEventCustomer$inboundSchema;
  /** @deprecated use `LeadCreatedEventCustomer$outboundSchema` instead. */
  export const outboundSchema = LeadCreatedEventCustomer$outboundSchema;
  /** @deprecated use `LeadCreatedEventCustomer$Outbound` instead. */
  export type Outbound = LeadCreatedEventCustomer$Outbound;
}

export function leadCreatedEventCustomerToJSON(
  leadCreatedEventCustomer: LeadCreatedEventCustomer,
): string {
  return JSON.stringify(
    LeadCreatedEventCustomer$outboundSchema.parse(leadCreatedEventCustomer),
  );
}

export function leadCreatedEventCustomerFromJSON(
  jsonString: string,
): SafeParseResult<LeadCreatedEventCustomer, SDKValidationError> {
  return safeParse(
    jsonString,
    (x) => LeadCreatedEventCustomer$inboundSchema.parse(JSON.parse(x)),
    `Failed to parse 'LeadCreatedEventCustomer' from JSON`,
  );
}

/** @internal */
export const LeadCreatedEventClick$inboundSchema: z.ZodType<
  LeadCreatedEventClick,
  z.ZodTypeDef,
  unknown
> = z.object({
  id: z.string(),
  url: z.string(),
  country: z.string(),
  city: z.string(),
  region: z.string(),
  continent: z.string(),
  device: z.string(),
  browser: z.string(),
  os: z.string(),
  referer: z.string(),
  refererUrl: z.string(),
  qr: z.boolean().optional(),
  ip: z.string(),
});

/** @internal */
export type LeadCreatedEventClick$Outbound = {
  id: string;
  url: string;
  country: string;
  city: string;
  region: string;
  continent: string;
  device: string;
  browser: string;
  os: string;
  referer: string;
  refererUrl: string;
  qr?: boolean | undefined;
  ip: string;
};

/** @internal */
export const LeadCreatedEventClick$outboundSchema: z.ZodType<
  LeadCreatedEventClick$Outbound,
  z.ZodTypeDef,
  LeadCreatedEventClick
> = z.object({
  id: z.string(),
  url: z.string(),
  country: z.string(),
  city: z.string(),
  region: z.string(),
  continent: z.string(),
  device: z.string(),
  browser: z.string(),
  os: z.string(),
  referer: z.string(),
  refererUrl: z.string(),
  qr: z.boolean().optional(),
  ip: z.string(),
});

/**
 * @internal
 * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
 */
export namespace LeadCreatedEventClick$ {
  /** @deprecated use `LeadCreatedEventClick$inboundSchema` instead. */
  export const inboundSchema = LeadCreatedEventClick$inboundSchema;
  /** @deprecated use `LeadCreatedEventClick$outboundSchema` instead. */
  export const outboundSchema = LeadCreatedEventClick$outboundSchema;
  /** @deprecated use `LeadCreatedEventClick$Outbound` instead. */
  export type Outbound = LeadCreatedEventClick$Outbound;
}

export function leadCreatedEventClickToJSON(
  leadCreatedEventClick: LeadCreatedEventClick,
): string {
  return JSON.stringify(
    LeadCreatedEventClick$outboundSchema.parse(leadCreatedEventClick),
  );
}

export function leadCreatedEventClickFromJSON(
  jsonString: string,
): SafeParseResult<LeadCreatedEventClick, SDKValidationError> {
  return safeParse(
    jsonString,
    (x) => LeadCreatedEventClick$inboundSchema.parse(JSON.parse(x)),
    `Failed to parse 'LeadCreatedEventClick' from JSON`,
  );
}

/** @internal */
export const LeadCreatedEventGeo$inboundSchema: z.ZodType<
  LeadCreatedEventGeo,
  z.ZodTypeDef,
  unknown
> = z.object({
  AF: z.string().optional(),
  AL: z.string().optional(),
  DZ: z.string().optional(),
  AS: z.string().optional(),
  AD: z.string().optional(),
  AO: z.string().optional(),
  AI: z.string().optional(),
  AQ: z.string().optional(),
  AG: z.string().optional(),
  AR: z.string().optional(),
  AM: z.string().optional(),
  AW: z.string().optional(),
  AU: z.string().optional(),
  AT: z.string().optional(),
  AZ: z.string().optional(),
  BS: z.string().optional(),
  BH: z.string().optional(),
  BD: z.string().optional(),
  BB: z.string().optional(),
  BY: z.string().optional(),
  BE: z.string().optional(),
  BZ: z.string().optional(),
  BJ: z.string().optional(),
  BM: z.string().optional(),
  BT: z.string().optional(),
  BO: z.string().optional(),
  BA: z.string().optional(),
  BW: z.string().optional(),
  BV: z.string().optional(),
  BR: z.string().optional(),
  IO: z.string().optional(),
  BN: z.string().optional(),
  BG: z.string().optional(),
  BF: z.string().optional(),
  BI: z.string().optional(),
  KH: z.string().optional(),
  CM: z.string().optional(),
  CA: z.string().optional(),
  CV: z.string().optional(),
  KY: z.string().optional(),
  CF: z.string().optional(),
  TD: z.string().optional(),
  CL: z.string().optional(),
  CN: z.string().optional(),
  CX: z.string().optional(),
  CC: z.string().optional(),
  CO: z.string().optional(),
  KM: z.string().optional(),
  CG: z.string().optional(),
  CD: z.string().optional(),
  CK: z.string().optional(),
  CR: z.string().optional(),
  CI: z.string().optional(),
  HR: z.string().optional(),
  CU: z.string().optional(),
  CY: z.string().optional(),
  CZ: z.string().optional(),
  DK: z.string().optional(),
  DJ: z.string().optional(),
  DM: z.string().optional(),
  DO: z.string().optional(),
  EC: z.string().optional(),
  EG: z.string().optional(),
  SV: z.string().optional(),
  GQ: z.string().optional(),
  ER: z.string().optional(),
  EE: z.string().optional(),
  ET: z.string().optional(),
  FK: z.string().optional(),
  FO: z.string().optional(),
  FJ: z.string().optional(),
  FI: z.string().optional(),
  FR: z.string().optional(),
  GF: z.string().optional(),
  PF: z.string().optional(),
  TF: z.string().optional(),
  GA: z.string().optional(),
  GM: z.string().optional(),
  GE: z.string().optional(),
  DE: z.string().optional(),
  GH: z.string().optional(),
  GI: z.string().optional(),
  GR: z.string().optional(),
  GL: z.string().optional(),
  GD: z.string().optional(),
  GP: z.string().optional(),
  GU: z.string().optional(),
  GT: z.string().optional(),
  GN: z.string().optional(),
  GW: z.string().optional(),
  GY: z.string().optional(),
  HT: z.string().optional(),
  HM: z.string().optional(),
  VA: z.string().optional(),
  HN: z.string().optional(),
  HK: z.string().optional(),
  HU: z.string().optional(),
  IS: z.string().optional(),
  IN: z.string().optional(),
  ID: z.string().optional(),
  IR: z.string().optional(),
  IQ: z.string().optional(),
  IE: z.string().optional(),
  IL: z.string().optional(),
  IT: z.string().optional(),
  JM: z.string().optional(),
  JP: z.string().optional(),
  JO: z.string().optional(),
  KZ: z.string().optional(),
  KE: z.string().optional(),
  KI: z.string().optional(),
  KP: z.string().optional(),
  KR: z.string().optional(),
  KW: z.string().optional(),
  KG: z.string().optional(),
  LA: z.string().optional(),
  LV: z.string().optional(),
  LB: z.string().optional(),
  LS: z.string().optional(),
  LR: z.string().optional(),
  LY: z.string().optional(),
  LI: z.string().optional(),
  LT: z.string().optional(),
  LU: z.string().optional(),
  MO: z.string().optional(),
  MG: z.string().optional(),
  MW: z.string().optional(),
  MY: z.string().optional(),
  MV: z.string().optional(),
  ML: z.string().optional(),
  MT: z.string().optional(),
  MH: z.string().optional(),
  MQ: z.string().optional(),
  MR: z.string().optional(),
  MU: z.string().optional(),
  YT: z.string().optional(),
  MX: z.string().optional(),
  FM: z.string().optional(),
  MD: z.string().optional(),
  MC: z.string().optional(),
  MN: z.string().optional(),
  MS: z.string().optional(),
  MA: z.string().optional(),
  MZ: z.string().optional(),
  MM: z.string().optional(),
  NA: z.string().optional(),
  NR: z.string().optional(),
  NP: z.string().optional(),
  NL: z.string().optional(),
  NC: z.string().optional(),
  NZ: z.string().optional(),
  NI: z.string().optional(),
  NE: z.string().optional(),
  NG: z.string().optional(),
  NU: z.string().optional(),
  NF: z.string().optional(),
  MK: z.string().optional(),
  MP: z.string().optional(),
  NO: z.string().optional(),
  OM: z.string().optional(),
  PK: z.string().optional(),
  PW: z.string().optional(),
  PS: z.string().optional(),
  PA: z.string().optional(),
  PG: z.string().optional(),
  PY: z.string().optional(),
  PE: z.string().optional(),
  PH: z.string().optional(),
  PN: z.string().optional(),
  PL: z.string().optional(),
  PT: z.string().optional(),
  PR: z.string().optional(),
  QA: z.string().optional(),
  RE: z.string().optional(),
  RO: z.string().optional(),
  RU: z.string().optional(),
  RW: z.string().optional(),
  SH: z.string().optional(),
  KN: z.string().optional(),
  LC: z.string().optional(),
  PM: z.string().optional(),
  VC: z.string().optional(),
  WS: z.string().optional(),
  SM: z.string().optional(),
  ST: z.string().optional(),
  SA: z.string().optional(),
  SN: z.string().optional(),
  SC: z.string().optional(),
  SL: z.string().optional(),
  SG: z.string().optional(),
  SK: z.string().optional(),
  SI: z.string().optional(),
  SB: z.string().optional(),
  SO: z.string().optional(),
  ZA: z.string().optional(),
  GS: z.string().optional(),
  ES: z.string().optional(),
  LK: z.string().optional(),
  SD: z.string().optional(),
  SR: z.string().optional(),
  SJ: z.string().optional(),
  SZ: z.string().optional(),
  SE: z.string().optional(),
  CH: z.string().optional(),
  SY: z.string().optional(),
  TW: z.string().optional(),
  TJ: z.string().optional(),
  TZ: z.string().optional(),
  TH: z.string().optional(),
  TL: z.string().optional(),
  TG: z.string().optional(),
  TK: z.string().optional(),
  TO: z.string().optional(),
  TT: z.string().optional(),
  TN: z.string().optional(),
  TR: z.string().optional(),
  TM: z.string().optional(),
  TC: z.string().optional(),
  TV: z.string().optional(),
  UG: z.string().optional(),
  UA: z.string().optional(),
  AE: z.string().optional(),
  GB: z.string().optional(),
  US: z.string().optional(),
  UM: z.string().optional(),
  UY: z.string().optional(),
  UZ: z.string().optional(),
  VU: z.string().optional(),
  VE: z.string().optional(),
  VN: z.string().optional(),
  VG: z.string().optional(),
  VI: z.string().optional(),
  WF: z.string().optional(),
  EH: z.string().optional(),
  YE: z.string().optional(),
  ZM: z.string().optional(),
  ZW: z.string().optional(),
  AX: z.string().optional(),
  BQ: z.string().optional(),
  CW: z.string().optional(),
  GG: z.string().optional(),
  IM: z.string().optional(),
  JE: z.string().optional(),
  ME: z.string().optional(),
  BL: z.string().optional(),
  MF: z.string().optional(),
  RS: z.string().optional(),
  SX: z.string().optional(),
  SS: z.string().optional(),
  XK: z.string().optional(),
}).transform((v) => {
  return remap$(v, {
    "AF": "af",
    "AL": "al",
    "DZ": "dz",
    "AS": "as",
    "AD": "ad",
    "AO": "ao",
    "AI": "ai",
    "AQ": "aq",
    "AG": "ag",
    "AR": "ar",
    "AM": "am",
    "AW": "aw",
    "AU": "au",
    "AT": "at",
    "AZ": "az",
    "BS": "bs",
    "BH": "bh",
    "BD": "bd",
    "BB": "bb",
    "BY": "by",
    "BE": "be",
    "BZ": "bz",
    "BJ": "bj",
    "BM": "bm",
    "BT": "bt",
    "BO": "bo",
    "BA": "ba",
    "BW": "bw",
    "BV": "bv",
    "BR": "br",
    "IO": "io",
    "BN": "bn",
    "BG": "bg",
    "BF": "bf",
    "BI": "bi",
    "KH": "kh",
    "CM": "cm",
    "CA": "ca",
    "CV": "cv",
    "KY": "ky",
    "CF": "cf",
    "TD": "td",
    "CL": "cl",
    "CN": "cn",
    "CX": "cx",
    "CC": "cc",
    "CO": "co",
    "KM": "km",
    "CG": "cg",
    "CD": "cd",
    "CK": "ck",
    "CR": "cr",
    "CI": "ci",
    "HR": "hr",
    "CU": "cu",
    "CY": "cy",
    "CZ": "cz",
    "DK": "dk",
    "DJ": "dj",
    "DM": "dm",
    "DO": "do",
    "EC": "ec",
    "EG": "eg",
    "SV": "sv",
    "GQ": "gq",
    "ER": "er",
    "EE": "ee",
    "ET": "et",
    "FK": "fk",
    "FO": "fo",
    "FJ": "fj",
    "FI": "fi",
    "FR": "fr",
    "GF": "gf",
    "PF": "pf",
    "TF": "tf",
    "GA": "ga",
    "GM": "gm",
    "GE": "ge",
    "DE": "de",
    "GH": "gh",
    "GI": "gi",
    "GR": "gr",
    "GL": "gl",
    "GD": "gd",
    "GP": "gp",
    "GU": "gu",
    "GT": "gt",
    "GN": "gn",
    "GW": "gw",
    "GY": "gy",
    "HT": "ht",
    "HM": "hm",
    "VA": "va",
    "HN": "hn",
    "HK": "hk",
    "HU": "hu",
    "IS": "is",
    "IN": "in",
    "ID": "id",
    "IR": "ir",
    "IQ": "iq",
    "IE": "ie",
    "IL": "il",
    "IT": "it",
    "JM": "jm",
    "JP": "jp",
    "JO": "jo",
    "KZ": "kz",
    "KE": "ke",
    "KI": "ki",
    "KP": "kp",
    "KR": "kr",
    "KW": "kw",
    "KG": "kg",
    "LA": "la",
    "LV": "lv",
    "LB": "lb",
    "LS": "ls",
    "LR": "lr",
    "LY": "ly",
    "LI": "li",
    "LT": "lt",
    "LU": "lu",
    "MO": "mo",
    "MG": "mg",
    "MW": "mw",
    "MY": "my",
    "MV": "mv",
    "ML": "ml",
    "MT": "mt",
    "MH": "mh",
    "MQ": "mq",
    "MR": "mr",
    "MU": "mu",
    "YT": "yt",
    "MX": "mx",
    "FM": "fm",
    "MD": "md",
    "MC": "mc",
    "MN": "mn",
    "MS": "ms",
    "MA": "ma",
    "MZ": "mz",
    "MM": "mm",
    "NA": "na",
    "NR": "nr",
    "NP": "np",
    "NL": "nl",
    "NC": "nc",
    "NZ": "nz",
    "NI": "ni",
    "NE": "ne",
    "NG": "ng",
    "NU": "nu",
    "NF": "nf",
    "MK": "mk",
    "MP": "mp",
    "NO": "no",
    "OM": "om",
    "PK": "pk",
    "PW": "pw",
    "PS": "ps",
    "PA": "pa",
    "PG": "pg",
    "PY": "py",
    "PE": "pe",
    "PH": "ph",
    "PN": "pn",
    "PL": "pl",
    "PT": "pt",
    "PR": "pr",
    "QA": "qa",
    "RE": "re",
    "RO": "ro",
    "RU": "ru",
    "RW": "rw",
    "SH": "sh",
    "KN": "kn",
    "LC": "lc",
    "PM": "pm",
    "VC": "vc",
    "WS": "ws",
    "SM": "sm",
    "ST": "st",
    "SA": "sa",
    "SN": "sn",
    "SC": "sc",
    "SL": "sl",
    "SG": "sg",
    "SK": "sk",
    "SI": "si",
    "SB": "sb",
    "SO": "so",
    "ZA": "za",
    "GS": "gs",
    "ES": "es",
    "LK": "lk",
    "SD": "sd",
    "SR": "sr",
    "SJ": "sj",
    "SZ": "sz",
    "SE": "se",
    "CH": "ch",
    "SY": "sy",
    "TW": "tw",
    "TJ": "tj",
    "TZ": "tz",
    "TH": "th",
    "TL": "tl",
    "TG": "tg",
    "TK": "tk",
    "TO": "to",
    "TT": "tt",
    "TN": "tn",
    "TR": "tr",
    "TM": "tm",
    "TC": "tc",
    "TV": "tv",
    "UG": "ug",
    "UA": "ua",
    "AE": "ae",
    "GB": "gb",
    "US": "us",
    "UM": "um",
    "UY": "uy",
    "UZ": "uz",
    "VU": "vu",
    "VE": "ve",
    "VN": "vn",
    "VG": "vg",
    "VI": "vi",
    "WF": "wf",
    "EH": "eh",
    "YE": "ye",
    "ZM": "zm",
    "ZW": "zw",
    "AX": "ax",
    "BQ": "bq",
    "CW": "cw",
    "GG": "gg",
    "IM": "im",
    "JE": "je",
    "ME": "me",
    "BL": "bl",
    "MF": "mf",
    "RS": "rs",
    "SX": "sx",
    "SS": "ss",
    "XK": "xk",
  });
});

/** @internal */
export type LeadCreatedEventGeo$Outbound = {
  AF?: string | undefined;
  AL?: string | undefined;
  DZ?: string | undefined;
  AS?: string | undefined;
  AD?: string | undefined;
  AO?: string | undefined;
  AI?: string | undefined;
  AQ?: string | undefined;
  AG?: string | undefined;
  AR?: string | undefined;
  AM?: string | undefined;
  AW?: string | undefined;
  AU?: string | undefined;
  AT?: string | undefined;
  AZ?: string | undefined;
  BS?: string | undefined;
  BH?: string | undefined;
  BD?: string | undefined;
  BB?: string | undefined;
  BY?: string | undefined;
  BE?: string | undefined;
  BZ?: string | undefined;
  BJ?: string | undefined;
  BM?: string | undefined;
  BT?: string | undefined;
  BO?: string | undefined;
  BA?: string | undefined;
  BW?: string | undefined;
  BV?: string | undefined;
  BR?: string | undefined;
  IO?: string | undefined;
  BN?: string | undefined;
  BG?: string | undefined;
  BF?: string | undefined;
  BI?: string | undefined;
  KH?: string | undefined;
  CM?: string | undefined;
  CA?: string | undefined;
  CV?: string | undefined;
  KY?: string | undefined;
  CF?: string | undefined;
  TD?: string | undefined;
  CL?: string | undefined;
  CN?: string | undefined;
  CX?: string | undefined;
  CC?: string | undefined;
  CO?: string | undefined;
  KM?: string | undefined;
  CG?: string | undefined;
  CD?: string | undefined;
  CK?: string | undefined;
  CR?: string | undefined;
  CI?: string | undefined;
  HR?: string | undefined;
  CU?: string | undefined;
  CY?: string | undefined;
  CZ?: string | undefined;
  DK?: string | undefined;
  DJ?: string | undefined;
  DM?: string | undefined;
  DO?: string | undefined;
  EC?: string | undefined;
  EG?: string | undefined;
  SV?: string | undefined;
  GQ?: string | undefined;
  ER?: string | undefined;
  EE?: string | undefined;
  ET?: string | undefined;
  FK?: string | undefined;
  FO?: string | undefined;
  FJ?: string | undefined;
  FI?: string | undefined;
  FR?: string | undefined;
  GF?: string | undefined;
  PF?: string | undefined;
  TF?: string | undefined;
  GA?: string | undefined;
  GM?: string | undefined;
  GE?: string | undefined;
  DE?: string | undefined;
  GH?: string | undefined;
  GI?: string | undefined;
  GR?: string | undefined;
  GL?: string | undefined;
  GD?: string | undefined;
  GP?: string | undefined;
  GU?: string | undefined;
  GT?: string | undefined;
  GN?: string | undefined;
  GW?: string | undefined;
  GY?: string | undefined;
  HT?: string | undefined;
  HM?: string | undefined;
  VA?: string | undefined;
  HN?: string | undefined;
  HK?: string | undefined;
  HU?: string | undefined;
  IS?: string | undefined;
  IN?: string | undefined;
  ID?: string | undefined;
  IR?: string | undefined;
  IQ?: string | undefined;
  IE?: string | undefined;
  IL?: string | undefined;
  IT?: string | undefined;
  JM?: string | undefined;
  JP?: string | undefined;
  JO?: string | undefined;
  KZ?: string | undefined;
  KE?: string | undefined;
  KI?: string | undefined;
  KP?: string | undefined;
  KR?: string | undefined;
  KW?: string | undefined;
  KG?: string | undefined;
  LA?: string | undefined;
  LV?: string | undefined;
  LB?: string | undefined;
  LS?: string | undefined;
  LR?: string | undefined;
  LY?: string | undefined;
  LI?: string | undefined;
  LT?: string | undefined;
  LU?: string | undefined;
  MO?: string | undefined;
  MG?: string | undefined;
  MW?: string | undefined;
  MY?: string | undefined;
  MV?: string | undefined;
  ML?: string | undefined;
  MT?: string | undefined;
  MH?: string | undefined;
  MQ?: string | undefined;
  MR?: string | undefined;
  MU?: string | undefined;
  YT?: string | undefined;
  MX?: string | undefined;
  FM?: string | undefined;
  MD?: string | undefined;
  MC?: string | undefined;
  MN?: string | undefined;
  MS?: string | undefined;
  MA?: string | undefined;
  MZ?: string | undefined;
  MM?: string | undefined;
  NA?: string | undefined;
  NR?: string | undefined;
  NP?: string | undefined;
  NL?: string | undefined;
  NC?: string | undefined;
  NZ?: string | undefined;
  NI?: string | undefined;
  NE?: string | undefined;
  NG?: string | undefined;
  NU?: string | undefined;
  NF?: string | undefined;
  MK?: string | undefined;
  MP?: string | undefined;
  NO?: string | undefined;
  OM?: string | undefined;
  PK?: string | undefined;
  PW?: string | undefined;
  PS?: string | undefined;
  PA?: string | undefined;
  PG?: string | undefined;
  PY?: string | undefined;
  PE?: string | undefined;
  PH?: string | undefined;
  PN?: string | undefined;
  PL?: string | undefined;
  PT?: string | undefined;
  PR?: string | undefined;
  QA?: string | undefined;
  RE?: string | undefined;
  RO?: string | undefined;
  RU?: string | undefined;
  RW?: string | undefined;
  SH?: string | undefined;
  KN?: string | undefined;
  LC?: string | undefined;
  PM?: string | undefined;
  VC?: string | undefined;
  WS?: string | undefined;
  SM?: string | undefined;
  ST?: string | undefined;
  SA?: string | undefined;
  SN?: string | undefined;
  SC?: string | undefined;
  SL?: string | undefined;
  SG?: string | undefined;
  SK?: string | undefined;
  SI?: string | undefined;
  SB?: string | undefined;
  SO?: string | undefined;
  ZA?: string | undefined;
  GS?: string | undefined;
  ES?: string | undefined;
  LK?: string | undefined;
  SD?: string | undefined;
  SR?: string | undefined;
  SJ?: string | undefined;
  SZ?: string | undefined;
  SE?: string | undefined;
  CH?: string | undefined;
  SY?: string | undefined;
  TW?: string | undefined;
  TJ?: string | undefined;
  TZ?: string | undefined;
  TH?: string | undefined;
  TL?: string | undefined;
  TG?: string | undefined;
  TK?: string | undefined;
  TO?: string | undefined;
  TT?: string | undefined;
  TN?: string | undefined;
  TR?: string | undefined;
  TM?: string | undefined;
  TC?: string | undefined;
  TV?: string | undefined;
  UG?: string | undefined;
  UA?: string | undefined;
  AE?: string | undefined;
  GB?: string | undefined;
  US?: string | undefined;
  UM?: string | undefined;
  UY?: string | undefined;
  UZ?: string | undefined;
  VU?: string | undefined;
  VE?: string | undefined;
  VN?: string | undefined;
  VG?: string | undefined;
  VI?: string | undefined;
  WF?: string | undefined;
  EH?: string | undefined;
  YE?: string | undefined;
  ZM?: string | undefined;
  ZW?: string | undefined;
  AX?: string | undefined;
  BQ?: string | undefined;
  CW?: string | undefined;
  GG?: string | undefined;
  IM?: string | undefined;
  JE?: string | undefined;
  ME?: string | undefined;
  BL?: string | undefined;
  MF?: string | undefined;
  RS?: string | undefined;
  SX?: string | undefined;
  SS?: string | undefined;
  XK?: string | undefined;
};

/** @internal */
export const LeadCreatedEventGeo$outboundSchema: z.ZodType<
  LeadCreatedEventGeo$Outbound,
  z.ZodTypeDef,
  LeadCreatedEventGeo
> = z.object({
  af: z.string().optional(),
  al: z.string().optional(),
  dz: z.string().optional(),
  as: z.string().optional(),
  ad: z.string().optional(),
  ao: z.string().optional(),
  ai: z.string().optional(),
  aq: z.string().optional(),
  ag: z.string().optional(),
  ar: z.string().optional(),
  am: z.string().optional(),
  aw: z.string().optional(),
  au: z.string().optional(),
  at: z.string().optional(),
  az: z.string().optional(),
  bs: z.string().optional(),
  bh: z.string().optional(),
  bd: z.string().optional(),
  bb: z.string().optional(),
  by: z.string().optional(),
  be: z.string().optional(),
  bz: z.string().optional(),
  bj: z.string().optional(),
  bm: z.string().optional(),
  bt: z.string().optional(),
  bo: z.string().optional(),
  ba: z.string().optional(),
  bw: z.string().optional(),
  bv: z.string().optional(),
  br: z.string().optional(),
  io: z.string().optional(),
  bn: z.string().optional(),
  bg: z.string().optional(),
  bf: z.string().optional(),
  bi: z.string().optional(),
  kh: z.string().optional(),
  cm: z.string().optional(),
  ca: z.string().optional(),
  cv: z.string().optional(),
  ky: z.string().optional(),
  cf: z.string().optional(),
  td: z.string().optional(),
  cl: z.string().optional(),
  cn: z.string().optional(),
  cx: z.string().optional(),
  cc: z.string().optional(),
  co: z.string().optional(),
  km: z.string().optional(),
  cg: z.string().optional(),
  cd: z.string().optional(),
  ck: z.string().optional(),
  cr: z.string().optional(),
  ci: z.string().optional(),
  hr: z.string().optional(),
  cu: z.string().optional(),
  cy: z.string().optional(),
  cz: z.string().optional(),
  dk: z.string().optional(),
  dj: z.string().optional(),
  dm: z.string().optional(),
  do: z.string().optional(),
  ec: z.string().optional(),
  eg: z.string().optional(),
  sv: z.string().optional(),
  gq: z.string().optional(),
  er: z.string().optional(),
  ee: z.string().optional(),
  et: z.string().optional(),
  fk: z.string().optional(),
  fo: z.string().optional(),
  fj: z.string().optional(),
  fi: z.string().optional(),
  fr: z.string().optional(),
  gf: z.string().optional(),
  pf: z.string().optional(),
  tf: z.string().optional(),
  ga: z.string().optional(),
  gm: z.string().optional(),
  ge: z.string().optional(),
  de: z.string().optional(),
  gh: z.string().optional(),
  gi: z.string().optional(),
  gr: z.string().optional(),
  gl: z.string().optional(),
  gd: z.string().optional(),
  gp: z.string().optional(),
  gu: z.string().optional(),
  gt: z.string().optional(),
  gn: z.string().optional(),
  gw: z.string().optional(),
  gy: z.string().optional(),
  ht: z.string().optional(),
  hm: z.string().optional(),
  va: z.string().optional(),
  hn: z.string().optional(),
  hk: z.string().optional(),
  hu: z.string().optional(),
  is: z.string().optional(),
  in: z.string().optional(),
  id: z.string().optional(),
  ir: z.string().optional(),
  iq: z.string().optional(),
  ie: z.string().optional(),
  il: z.string().optional(),
  it: z.string().optional(),
  jm: z.string().optional(),
  jp: z.string().optional(),
  jo: z.string().optional(),
  kz: z.string().optional(),
  ke: z.string().optional(),
  ki: z.string().optional(),
  kp: z.string().optional(),
  kr: z.string().optional(),
  kw: z.string().optional(),
  kg: z.string().optional(),
  la: z.string().optional(),
  lv: z.string().optional(),
  lb: z.string().optional(),
  ls: z.string().optional(),
  lr: z.string().optional(),
  ly: z.string().optional(),
  li: z.string().optional(),
  lt: z.string().optional(),
  lu: z.string().optional(),
  mo: z.string().optional(),
  mg: z.string().optional(),
  mw: z.string().optional(),
  my: z.string().optional(),
  mv: z.string().optional(),
  ml: z.string().optional(),
  mt: z.string().optional(),
  mh: z.string().optional(),
  mq: z.string().optional(),
  mr: z.string().optional(),
  mu: z.string().optional(),
  yt: z.string().optional(),
  mx: z.string().optional(),
  fm: z.string().optional(),
  md: z.string().optional(),
  mc: z.string().optional(),
  mn: z.string().optional(),
  ms: z.string().optional(),
  ma: z.string().optional(),
  mz: z.string().optional(),
  mm: z.string().optional(),
  na: z.string().optional(),
  nr: z.string().optional(),
  np: z.string().optional(),
  nl: z.string().optional(),
  nc: z.string().optional(),
  nz: z.string().optional(),
  ni: z.string().optional(),
  ne: z.string().optional(),
  ng: z.string().optional(),
  nu: z.string().optional(),
  nf: z.string().optional(),
  mk: z.string().optional(),
  mp: z.string().optional(),
  no: z.string().optional(),
  om: z.string().optional(),
  pk: z.string().optional(),
  pw: z.string().optional(),
  ps: z.string().optional(),
  pa: z.string().optional(),
  pg: z.string().optional(),
  py: z.string().optional(),
  pe: z.string().optional(),
  ph: z.string().optional(),
  pn: z.string().optional(),
  pl: z.string().optional(),
  pt: z.string().optional(),
  pr: z.string().optional(),
  qa: z.string().optional(),
  re: z.string().optional(),
  ro: z.string().optional(),
  ru: z.string().optional(),
  rw: z.string().optional(),
  sh: z.string().optional(),
  kn: z.string().optional(),
  lc: z.string().optional(),
  pm: z.string().optional(),
  vc: z.string().optional(),
  ws: z.string().optional(),
  sm: z.string().optional(),
  st: z.string().optional(),
  sa: z.string().optional(),
  sn: z.string().optional(),
  sc: z.string().optional(),
  sl: z.string().optional(),
  sg: z.string().optional(),
  sk: z.string().optional(),
  si: z.string().optional(),
  sb: z.string().optional(),
  so: z.string().optional(),
  za: z.string().optional(),
  gs: z.string().optional(),
  es: z.string().optional(),
  lk: z.string().optional(),
  sd: z.string().optional(),
  sr: z.string().optional(),
  sj: z.string().optional(),
  sz: z.string().optional(),
  se: z.string().optional(),
  ch: z.string().optional(),
  sy: z.string().optional(),
  tw: z.string().optional(),
  tj: z.string().optional(),
  tz: z.string().optional(),
  th: z.string().optional(),
  tl: z.string().optional(),
  tg: z.string().optional(),
  tk: z.string().optional(),
  to: z.string().optional(),
  tt: z.string().optional(),
  tn: z.string().optional(),
  tr: z.string().optional(),
  tm: z.string().optional(),
  tc: z.string().optional(),
  tv: z.string().optional(),
  ug: z.string().optional(),
  ua: z.string().optional(),
  ae: z.string().optional(),
  gb: z.string().optional(),
  us: z.string().optional(),
  um: z.string().optional(),
  uy: z.string().optional(),
  uz: z.string().optional(),
  vu: z.string().optional(),
  ve: z.string().optional(),
  vn: z.string().optional(),
  vg: z.string().optional(),
  vi: z.string().optional(),
  wf: z.string().optional(),
  eh: z.string().optional(),
  ye: z.string().optional(),
  zm: z.string().optional(),
  zw: z.string().optional(),
  ax: z.string().optional(),
  bq: z.string().optional(),
  cw: z.string().optional(),
  gg: z.string().optional(),
  im: z.string().optional(),
  je: z.string().optional(),
  me: z.string().optional(),
  bl: z.string().optional(),
  mf: z.string().optional(),
  rs: z.string().optional(),
  sx: z.string().optional(),
  ss: z.string().optional(),
  xk: z.string().optional(),
}).transform((v) => {
  return remap$(v, {
    af: "AF",
    al: "AL",
    dz: "DZ",
    as: "AS",
    ad: "AD",
    ao: "AO",
    ai: "AI",
    aq: "AQ",
    ag: "AG",
    ar: "AR",
    am: "AM",
    aw: "AW",
    au: "AU",
    at: "AT",
    az: "AZ",
    bs: "BS",
    bh: "BH",
    bd: "BD",
    bb: "BB",
    by: "BY",
    be: "BE",
    bz: "BZ",
    bj: "BJ",
    bm: "BM",
    bt: "BT",
    bo: "BO",
    ba: "BA",
    bw: "BW",
    bv: "BV",
    br: "BR",
    io: "IO",
    bn: "BN",
    bg: "BG",
    bf: "BF",
    bi: "BI",
    kh: "KH",
    cm: "CM",
    ca: "CA",
    cv: "CV",
    ky: "KY",
    cf: "CF",
    td: "TD",
    cl: "CL",
    cn: "CN",
    cx: "CX",
    cc: "CC",
    co: "CO",
    km: "KM",
    cg: "CG",
    cd: "CD",
    ck: "CK",
    cr: "CR",
    ci: "CI",
    hr: "HR",
    cu: "CU",
    cy: "CY",
    cz: "CZ",
    dk: "DK",
    dj: "DJ",
    dm: "DM",
    do: "DO",
    ec: "EC",
    eg: "EG",
    sv: "SV",
    gq: "GQ",
    er: "ER",
    ee: "EE",
    et: "ET",
    fk: "FK",
    fo: "FO",
    fj: "FJ",
    fi: "FI",
    fr: "FR",
    gf: "GF",
    pf: "PF",
    tf: "TF",
    ga: "GA",
    gm: "GM",
    ge: "GE",
    de: "DE",
    gh: "GH",
    gi: "GI",
    gr: "GR",
    gl: "GL",
    gd: "GD",
    gp: "GP",
    gu: "GU",
    gt: "GT",
    gn: "GN",
    gw: "GW",
    gy: "GY",
    ht: "HT",
    hm: "HM",
    va: "VA",
    hn: "HN",
    hk: "HK",
    hu: "HU",
    is: "IS",
    in: "IN",
    id: "ID",
    ir: "IR",
    iq: "IQ",
    ie: "IE",
    il: "IL",
    it: "IT",
    jm: "JM",
    jp: "JP",
    jo: "JO",
    kz: "KZ",
    ke: "KE",
    ki: "KI",
    kp: "KP",
    kr: "KR",
    kw: "KW",
    kg: "KG",
    la: "LA",
    lv: "LV",
    lb: "LB",
    ls: "LS",
    lr: "LR",
    ly: "LY",
    li: "LI",
    lt: "LT",
    lu: "LU",
    mo: "MO",
    mg: "MG",
    mw: "MW",
    my: "MY",
    mv: "MV",
    ml: "ML",
    mt: "MT",
    mh: "MH",
    mq: "MQ",
    mr: "MR",
    mu: "MU",
    yt: "YT",
    mx: "MX",
    fm: "FM",
    md: "MD",
    mc: "MC",
    mn: "MN",
    ms: "MS",
    ma: "MA",
    mz: "MZ",
    mm: "MM",
    na: "NA",
    nr: "NR",
    np: "NP",
    nl: "NL",
    nc: "NC",
    nz: "NZ",
    ni: "NI",
    ne: "NE",
    ng: "NG",
    nu: "NU",
    nf: "NF",
    mk: "MK",
    mp: "MP",
    no: "NO",
    om: "OM",
    pk: "PK",
    pw: "PW",
    ps: "PS",
    pa: "PA",
    pg: "PG",
    py: "PY",
    pe: "PE",
    ph: "PH",
    pn: "PN",
    pl: "PL",
    pt: "PT",
    pr: "PR",
    qa: "QA",
    re: "RE",
    ro: "RO",
    ru: "RU",
    rw: "RW",
    sh: "SH",
    kn: "KN",
    lc: "LC",
    pm: "PM",
    vc: "VC",
    ws: "WS",
    sm: "SM",
    st: "ST",
    sa: "SA",
    sn: "SN",
    sc: "SC",
    sl: "SL",
    sg: "SG",
    sk: "SK",
    si: "SI",
    sb: "SB",
    so: "SO",
    za: "ZA",
    gs: "GS",
    es: "ES",
    lk: "LK",
    sd: "SD",
    sr: "SR",
    sj: "SJ",
    sz: "SZ",
    se: "SE",
    ch: "CH",
    sy: "SY",
    tw: "TW",
    tj: "TJ",
    tz: "TZ",
    th: "TH",
    tl: "TL",
    tg: "TG",
    tk: "TK",
    to: "TO",
    tt: "TT",
    tn: "TN",
    tr: "TR",
    tm: "TM",
    tc: "TC",
    tv: "TV",
    ug: "UG",
    ua: "UA",
    ae: "AE",
    gb: "GB",
    us: "US",
    um: "UM",
    uy: "UY",
    uz: "UZ",
    vu: "VU",
    ve: "VE",
    vn: "VN",
    vg: "VG",
    vi: "VI",
    wf: "WF",
    eh: "EH",
    ye: "YE",
    zm: "ZM",
    zw: "ZW",
    ax: "AX",
    bq: "BQ",
    cw: "CW",
    gg: "GG",
    im: "IM",
    je: "JE",
    me: "ME",
    bl: "BL",
    mf: "MF",
    rs: "RS",
    sx: "SX",
    ss: "SS",
    xk: "XK",
  });
});

/**
 * @internal
 * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
 */
export namespace LeadCreatedEventGeo$ {
  /** @deprecated use `LeadCreatedEventGeo$inboundSchema` instead. */
  export const inboundSchema = LeadCreatedEventGeo$inboundSchema;
  /** @deprecated use `LeadCreatedEventGeo$outboundSchema` instead. */
  export const outboundSchema = LeadCreatedEventGeo$outboundSchema;
  /** @deprecated use `LeadCreatedEventGeo$Outbound` instead. */
  export type Outbound = LeadCreatedEventGeo$Outbound;
}

export function leadCreatedEventGeoToJSON(
  leadCreatedEventGeo: LeadCreatedEventGeo,
): string {
  return JSON.stringify(
    LeadCreatedEventGeo$outboundSchema.parse(leadCreatedEventGeo),
  );
}

export function leadCreatedEventGeoFromJSON(
  jsonString: string,
): SafeParseResult<LeadCreatedEventGeo, SDKValidationError> {
  return safeParse(
    jsonString,
    (x) => LeadCreatedEventGeo$inboundSchema.parse(JSON.parse(x)),
    `Failed to parse 'LeadCreatedEventGeo' from JSON`,
  );
}

/** @internal */
export const LeadCreatedEventLink$inboundSchema: z.ZodType<
  LeadCreatedEventLink,
  z.ZodTypeDef,
  unknown
> = z.object({
  id: z.string(),
  domain: z.string(),
  key: z.string(),
  url: z.string(),
  trackConversion: z.boolean().optional(),
  externalId: z.nullable(z.string()),
  tenantId: z.nullable(z.string()),
  archived: z.boolean().optional(),
  expiresAt: z.string(),
  expiredUrl: z.nullable(z.string()),
  password: z.nullable(z.string()),
  proxy: z.boolean().optional(),
  title: z.nullable(z.string()),
  description: z.nullable(z.string()),
  image: z.nullable(z.string()),
  video: z.nullable(z.string()),
  rewrite: z.boolean().optional(),
  doIndex: z.boolean().optional(),
  ios: z.nullable(z.string()),
  android: z.nullable(z.string()),
  geo: z.nullable(z.lazy(() => LeadCreatedEventGeo$inboundSchema)),
  publicStats: z.boolean().optional(),
  tagId: z.nullable(z.string()),
  tags: z.nullable(z.array(TagSchema$inboundSchema)),
  webhookIds: z.array(z.string()),
  comments: z.nullable(z.string()),
  shortLink: z.string(),
  qrCode: z.string(),
  utm_source: z.nullable(z.string()),
  utm_medium: z.nullable(z.string()),
  utm_campaign: z.nullable(z.string()),
  utm_term: z.nullable(z.string()),
  utm_content: z.nullable(z.string()),
  userId: z.nullable(z.string()),
  workspaceId: z.string(),
  clicks: z.number().default(0),
  lastClicked: z.string(),
  leads: z.number().default(0),
  sales: z.number().default(0),
  saleAmount: z.number().default(0),
  createdAt: z.string(),
  updatedAt: z.string(),
  projectId: z.string(),
  programId: z.nullable(z.string()),
}).transform((v) => {
  return remap$(v, {
    "utm_source": "utmSource",
    "utm_medium": "utmMedium",
    "utm_campaign": "utmCampaign",
    "utm_term": "utmTerm",
    "utm_content": "utmContent",
  });
});

/** @internal */
export type LeadCreatedEventLink$Outbound = {
  id: string;
  domain: string;
  key: string;
  url: string;
  trackConversion?: boolean | undefined;
  externalId: string | null;
  tenantId: string | null;
  archived?: boolean | undefined;
  expiresAt: string;
  expiredUrl: string | null;
  password: string | null;
  proxy?: boolean | undefined;
  title: string | null;
  description: string | null;
  image: string | null;
  video: string | null;
  rewrite?: boolean | undefined;
  doIndex?: boolean | undefined;
  ios: string | null;
  android: string | null;
  geo: LeadCreatedEventGeo$Outbound | null;
  publicStats?: boolean | undefined;
  tagId: string | null;
  tags: Array<TagSchema$Outbound> | null;
  webhookIds: Array<string>;
  comments: string | null;
  shortLink: string;
  qrCode: string;
  utm_source: string | null;
  utm_medium: string | null;
  utm_campaign: string | null;
  utm_term: string | null;
  utm_content: string | null;
  userId: string | null;
  workspaceId: string;
  clicks: number;
  lastClicked: string;
  leads: number;
  sales: number;
  saleAmount: number;
  createdAt: string;
  updatedAt: string;
  projectId: string;
  programId: string | null;
};

/** @internal */
export const LeadCreatedEventLink$outboundSchema: z.ZodType<
  LeadCreatedEventLink$Outbound,
  z.ZodTypeDef,
  LeadCreatedEventLink
> = z.object({
  id: z.string(),
  domain: z.string(),
  key: z.string(),
  url: z.string(),
  trackConversion: z.boolean().optional(),
  externalId: z.nullable(z.string()),
  tenantId: z.nullable(z.string()),
  archived: z.boolean().optional(),
  expiresAt: z.string(),
  expiredUrl: z.nullable(z.string()),
  password: z.nullable(z.string()),
  proxy: z.boolean().optional(),
  title: z.nullable(z.string()),
  description: z.nullable(z.string()),
  image: z.nullable(z.string()),
  video: z.nullable(z.string()),
  rewrite: z.boolean().optional(),
  doIndex: z.boolean().optional(),
  ios: z.nullable(z.string()),
  android: z.nullable(z.string()),
  geo: z.nullable(z.lazy(() => LeadCreatedEventGeo$outboundSchema)),
  publicStats: z.boolean().optional(),
  tagId: z.nullable(z.string()),
  tags: z.nullable(z.array(TagSchema$outboundSchema)),
  webhookIds: z.array(z.string()),
  comments: z.nullable(z.string()),
  shortLink: z.string(),
  qrCode: z.string(),
  utmSource: z.nullable(z.string()),
  utmMedium: z.nullable(z.string()),
  utmCampaign: z.nullable(z.string()),
  utmTerm: z.nullable(z.string()),
  utmContent: z.nullable(z.string()),
  userId: z.nullable(z.string()),
  workspaceId: z.string(),
  clicks: z.number().default(0),
  lastClicked: z.string(),
  leads: z.number().default(0),
  sales: z.number().default(0),
  saleAmount: z.number().default(0),
  createdAt: z.string(),
  updatedAt: z.string(),
  projectId: z.string(),
  programId: z.nullable(z.string()),
}).transform((v) => {
  return remap$(v, {
    utmSource: "utm_source",
    utmMedium: "utm_medium",
    utmCampaign: "utm_campaign",
    utmTerm: "utm_term",
    utmContent: "utm_content",
  });
});

/**
 * @internal
 * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
 */
export namespace LeadCreatedEventLink$ {
  /** @deprecated use `LeadCreatedEventLink$inboundSchema` instead. */
  export const inboundSchema = LeadCreatedEventLink$inboundSchema;
  /** @deprecated use `LeadCreatedEventLink$outboundSchema` instead. */
  export const outboundSchema = LeadCreatedEventLink$outboundSchema;
  /** @deprecated use `LeadCreatedEventLink$Outbound` instead. */
  export type Outbound = LeadCreatedEventLink$Outbound;
}

export function leadCreatedEventLinkToJSON(
  leadCreatedEventLink: LeadCreatedEventLink,
): string {
  return JSON.stringify(
    LeadCreatedEventLink$outboundSchema.parse(leadCreatedEventLink),
  );
}

export function leadCreatedEventLinkFromJSON(
  jsonString: string,
): SafeParseResult<LeadCreatedEventLink, SDKValidationError> {
  return safeParse(
    jsonString,
    (x) => LeadCreatedEventLink$inboundSchema.parse(JSON.parse(x)),
    `Failed to parse 'LeadCreatedEventLink' from JSON`,
  );
}

/** @internal */
export const LeadCreatedEventData$inboundSchema: z.ZodType<
  LeadCreatedEventData,
  z.ZodTypeDef,
  unknown
> = z.object({
  eventName: z.string(),
  customer: z.lazy(() => LeadCreatedEventCustomer$inboundSchema),
  click: z.lazy(() => LeadCreatedEventClick$inboundSchema),
  link: z.lazy(() => LeadCreatedEventLink$inboundSchema),
});

/** @internal */
export type LeadCreatedEventData$Outbound = {
  eventName: string;
  customer: LeadCreatedEventCustomer$Outbound;
  click: LeadCreatedEventClick$Outbound;
  link: LeadCreatedEventLink$Outbound;
};

/** @internal */
export const LeadCreatedEventData$outboundSchema: z.ZodType<
  LeadCreatedEventData$Outbound,
  z.ZodTypeDef,
  LeadCreatedEventData
> = z.object({
  eventName: z.string(),
  customer: z.lazy(() => LeadCreatedEventCustomer$outboundSchema),
  click: z.lazy(() => LeadCreatedEventClick$outboundSchema),
  link: z.lazy(() => LeadCreatedEventLink$outboundSchema),
});

/**
 * @internal
 * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
 */
export namespace LeadCreatedEventData$ {
  /** @deprecated use `LeadCreatedEventData$inboundSchema` instead. */
  export const inboundSchema = LeadCreatedEventData$inboundSchema;
  /** @deprecated use `LeadCreatedEventData$outboundSchema` instead. */
  export const outboundSchema = LeadCreatedEventData$outboundSchema;
  /** @deprecated use `LeadCreatedEventData$Outbound` instead. */
  export type Outbound = LeadCreatedEventData$Outbound;
}

export function leadCreatedEventDataToJSON(
  leadCreatedEventData: LeadCreatedEventData,
): string {
  return JSON.stringify(
    LeadCreatedEventData$outboundSchema.parse(leadCreatedEventData),
  );
}

export function leadCreatedEventDataFromJSON(
  jsonString: string,
): SafeParseResult<LeadCreatedEventData, SDKValidationError> {
  return safeParse(
    jsonString,
    (x) => LeadCreatedEventData$inboundSchema.parse(JSON.parse(x)),
    `Failed to parse 'LeadCreatedEventData' from JSON`,
  );
}

/** @internal */
export const LeadCreatedEvent$inboundSchema: z.ZodType<
  LeadCreatedEvent,
  z.ZodTypeDef,
  unknown
> = z.object({
  id: z.string(),
  event: LeadCreatedEventEvent$inboundSchema,
  createdAt: z.string(),
  data: z.lazy(() => LeadCreatedEventData$inboundSchema),
});

/** @internal */
export type LeadCreatedEvent$Outbound = {
  id: string;
  event: string;
  createdAt: string;
  data: LeadCreatedEventData$Outbound;
};

/** @internal */
export const LeadCreatedEvent$outboundSchema: z.ZodType<
  LeadCreatedEvent$Outbound,
  z.ZodTypeDef,
  LeadCreatedEvent
> = z.object({
  id: z.string(),
  event: LeadCreatedEventEvent$outboundSchema,
  createdAt: z.string(),
  data: z.lazy(() => LeadCreatedEventData$outboundSchema),
});

/**
 * @internal
 * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
 */
export namespace LeadCreatedEvent$ {
  /** @deprecated use `LeadCreatedEvent$inboundSchema` instead. */
  export const inboundSchema = LeadCreatedEvent$inboundSchema;
  /** @deprecated use `LeadCreatedEvent$outboundSchema` instead. */
  export const outboundSchema = LeadCreatedEvent$outboundSchema;
  /** @deprecated use `LeadCreatedEvent$Outbound` instead. */
  export type Outbound = LeadCreatedEvent$Outbound;
}

export function leadCreatedEventToJSON(
  leadCreatedEvent: LeadCreatedEvent,
): string {
  return JSON.stringify(
    LeadCreatedEvent$outboundSchema.parse(leadCreatedEvent),
  );
}

export function leadCreatedEventFromJSON(
  jsonString: string,
): SafeParseResult<LeadCreatedEvent, SDKValidationError> {
  return safeParse(
    jsonString,
    (x) => LeadCreatedEvent$inboundSchema.parse(JSON.parse(x)),
    `Failed to parse 'LeadCreatedEvent' from JSON`,
  );
}
