/*
 * 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";

/**
 * Type of event the webhook is subscribed to.
 */
export const PatchV2WebhooksWebhookIdEventTypeRequest = {
  CommentCreated: "comment.created",
  CommentResolved: "comment.resolved",
  CommentUnresolved: "comment.unresolved",
  CommentDeleted: "comment.deleted",
  ListCreated: "list.created",
  ListUpdated: "list.updated",
  ListDeleted: "list.deleted",
  ListAttributeCreated: "list-attribute.created",
  ListAttributeUpdated: "list-attribute.updated",
  ListEntryCreated: "list-entry.created",
  ListEntryUpdated: "list-entry.updated",
  ListEntryDeleted: "list-entry.deleted",
  ObjectAttributeCreated: "object-attribute.created",
  ObjectAttributeUpdated: "object-attribute.updated",
  NoteCreated: "note.created",
  NoteUpdated: "note.updated",
  NoteDeleted: "note.deleted",
  RecordCreated: "record.created",
  RecordMerged: "record.merged",
  RecordUpdated: "record.updated",
  RecordDeleted: "record.deleted",
  TaskCreated: "task.created",
  TaskUpdated: "task.updated",
  TaskDeleted: "task.deleted",
  WorkspaceMemberCreated: "workspace-member.created",
} as const;
/**
 * Type of event the webhook is subscribed to.
 */
export type PatchV2WebhooksWebhookIdEventTypeRequest = ClosedEnum<
  typeof PatchV2WebhooksWebhookIdEventTypeRequest
>;

export const PatchV2WebhooksWebhookIdDollarAndOperatorNotEqualsRequest = {
  NotEquals: "not_equals",
} as const;
export type PatchV2WebhooksWebhookIdDollarAndOperatorNotEqualsRequest =
  ClosedEnum<typeof PatchV2WebhooksWebhookIdDollarAndOperatorNotEqualsRequest>;

export type PatchV2WebhooksWebhookIdDollarAndNotEqualsRequest = {
  field: string;
  operator: PatchV2WebhooksWebhookIdDollarAndOperatorNotEqualsRequest;
  value: string;
};

export const PatchV2WebhooksWebhookIdDollarAndOperatorEqualsRequest = {
  Equals: "equals",
} as const;
export type PatchV2WebhooksWebhookIdDollarAndOperatorEqualsRequest = ClosedEnum<
  typeof PatchV2WebhooksWebhookIdDollarAndOperatorEqualsRequest
>;

export type PatchV2WebhooksWebhookIdDollarAndEqualsRequest = {
  field: string;
  operator: PatchV2WebhooksWebhookIdDollarAndOperatorEqualsRequest;
  value: string;
};

export type PatchV2WebhooksWebhookIdDollarAndRequestUnion =
  | PatchV2WebhooksWebhookIdDollarAndEqualsRequest
  | PatchV2WebhooksWebhookIdDollarAndNotEqualsRequest;

export type PatchV2WebhooksWebhookIdFilterRequest2 = {
  dollarAnd: Array<
    | PatchV2WebhooksWebhookIdDollarAndEqualsRequest
    | PatchV2WebhooksWebhookIdDollarAndNotEqualsRequest
  >;
};

export const PatchV2WebhooksWebhookIdDollarOrOperatorNotEqualsRequest = {
  NotEquals: "not_equals",
} as const;
export type PatchV2WebhooksWebhookIdDollarOrOperatorNotEqualsRequest =
  ClosedEnum<typeof PatchV2WebhooksWebhookIdDollarOrOperatorNotEqualsRequest>;

export type PatchV2WebhooksWebhookIdDollarOrNotEqualsRequest = {
  field: string;
  operator: PatchV2WebhooksWebhookIdDollarOrOperatorNotEqualsRequest;
  value: string;
};

export const PatchV2WebhooksWebhookIdDollarOrOperatorEqualsRequest = {
  Equals: "equals",
} as const;
export type PatchV2WebhooksWebhookIdDollarOrOperatorEqualsRequest = ClosedEnum<
  typeof PatchV2WebhooksWebhookIdDollarOrOperatorEqualsRequest
>;

export type PatchV2WebhooksWebhookIdDollarOrEqualsRequest = {
  field: string;
  operator: PatchV2WebhooksWebhookIdDollarOrOperatorEqualsRequest;
  value: string;
};

export type PatchV2WebhooksWebhookIdDollarOrRequestUnion =
  | PatchV2WebhooksWebhookIdDollarOrEqualsRequest
  | PatchV2WebhooksWebhookIdDollarOrNotEqualsRequest;

export type PatchV2WebhooksWebhookIdFilterRequest1 = {
  dollarOr: Array<
    | PatchV2WebhooksWebhookIdDollarOrEqualsRequest
    | PatchV2WebhooksWebhookIdDollarOrNotEqualsRequest
  >;
};

/**
 * Filters to determine whether the webhook event should be sent. If null, the filter always passes.
 */
export type PatchV2WebhooksWebhookIdFilterRequestUnion =
  | PatchV2WebhooksWebhookIdFilterRequest1
  | PatchV2WebhooksWebhookIdFilterRequest2;

export type PatchV2WebhooksWebhookIdSubscriptionRequest = {
  /**
   * Type of event the webhook is subscribed to.
   */
  eventType: PatchV2WebhooksWebhookIdEventTypeRequest;
  /**
   * Filters to determine whether the webhook event should be sent. If null, the filter always passes.
   */
  filter:
    | PatchV2WebhooksWebhookIdFilterRequest1
    | PatchV2WebhooksWebhookIdFilterRequest2
    | null;
};

export type PatchV2WebhooksWebhookIdDataRequest = {
  /**
   * URL where the webhook events will be delivered to.
   */
  targetUrl?: string | undefined;
  /**
   * One or more events the webhook is subscribed to.
   */
  subscriptions?:
    | Array<PatchV2WebhooksWebhookIdSubscriptionRequest>
    | undefined;
};

export type PatchV2WebhooksWebhookIdRequestBody = {
  data: PatchV2WebhooksWebhookIdDataRequest;
};

export type PatchV2WebhooksWebhookIdRequest = {
  webhookId: string;
  requestBody: PatchV2WebhooksWebhookIdRequestBody;
};

/**
 * Type of event the webhook is subscribed to.
 */
export const PatchV2WebhooksWebhookIdEventTypeResponse = {
  CommentCreated: "comment.created",
  CommentResolved: "comment.resolved",
  CommentUnresolved: "comment.unresolved",
  CommentDeleted: "comment.deleted",
  ListCreated: "list.created",
  ListUpdated: "list.updated",
  ListDeleted: "list.deleted",
  ListAttributeCreated: "list-attribute.created",
  ListAttributeUpdated: "list-attribute.updated",
  ListEntryCreated: "list-entry.created",
  ListEntryUpdated: "list-entry.updated",
  ListEntryDeleted: "list-entry.deleted",
  ObjectAttributeCreated: "object-attribute.created",
  ObjectAttributeUpdated: "object-attribute.updated",
  NoteCreated: "note.created",
  NoteUpdated: "note.updated",
  NoteDeleted: "note.deleted",
  RecordCreated: "record.created",
  RecordMerged: "record.merged",
  RecordUpdated: "record.updated",
  RecordDeleted: "record.deleted",
  TaskCreated: "task.created",
  TaskUpdated: "task.updated",
  TaskDeleted: "task.deleted",
  WorkspaceMemberCreated: "workspace-member.created",
} as const;
/**
 * Type of event the webhook is subscribed to.
 */
export type PatchV2WebhooksWebhookIdEventTypeResponse = ClosedEnum<
  typeof PatchV2WebhooksWebhookIdEventTypeResponse
>;

export const PatchV2WebhooksWebhookIdDollarAndOperatorNotEqualsResponse = {
  NotEquals: "not_equals",
} as const;
export type PatchV2WebhooksWebhookIdDollarAndOperatorNotEqualsResponse =
  ClosedEnum<typeof PatchV2WebhooksWebhookIdDollarAndOperatorNotEqualsResponse>;

export type PatchV2WebhooksWebhookIdDollarAndNotEqualsResponse = {
  field: string;
  operator: PatchV2WebhooksWebhookIdDollarAndOperatorNotEqualsResponse;
  value: string;
};

export const PatchV2WebhooksWebhookIdDollarAndOperatorEqualsResponse = {
  Equals: "equals",
} as const;
export type PatchV2WebhooksWebhookIdDollarAndOperatorEqualsResponse =
  ClosedEnum<typeof PatchV2WebhooksWebhookIdDollarAndOperatorEqualsResponse>;

export type PatchV2WebhooksWebhookIdDollarAndEqualsResponse = {
  field: string;
  operator: PatchV2WebhooksWebhookIdDollarAndOperatorEqualsResponse;
  value: string;
};

export type PatchV2WebhooksWebhookIdDollarAndResponseUnion =
  | PatchV2WebhooksWebhookIdDollarAndEqualsResponse
  | PatchV2WebhooksWebhookIdDollarAndNotEqualsResponse;

export type PatchV2WebhooksWebhookIdFilterResponse2 = {
  dollarAnd: Array<
    | PatchV2WebhooksWebhookIdDollarAndEqualsResponse
    | PatchV2WebhooksWebhookIdDollarAndNotEqualsResponse
  >;
};

export const PatchV2WebhooksWebhookIdDollarOrOperatorNotEqualsResponse = {
  NotEquals: "not_equals",
} as const;
export type PatchV2WebhooksWebhookIdDollarOrOperatorNotEqualsResponse =
  ClosedEnum<typeof PatchV2WebhooksWebhookIdDollarOrOperatorNotEqualsResponse>;

export type PatchV2WebhooksWebhookIdDollarOrNotEqualsResponse = {
  field: string;
  operator: PatchV2WebhooksWebhookIdDollarOrOperatorNotEqualsResponse;
  value: string;
};

export const PatchV2WebhooksWebhookIdDollarOrOperatorEqualsResponse = {
  Equals: "equals",
} as const;
export type PatchV2WebhooksWebhookIdDollarOrOperatorEqualsResponse = ClosedEnum<
  typeof PatchV2WebhooksWebhookIdDollarOrOperatorEqualsResponse
>;

export type PatchV2WebhooksWebhookIdDollarOrEqualsResponse = {
  field: string;
  operator: PatchV2WebhooksWebhookIdDollarOrOperatorEqualsResponse;
  value: string;
};

export type PatchV2WebhooksWebhookIdDollarOrResponseUnion =
  | PatchV2WebhooksWebhookIdDollarOrEqualsResponse
  | PatchV2WebhooksWebhookIdDollarOrNotEqualsResponse;

export type PatchV2WebhooksWebhookIdFilterResponse1 = {
  dollarOr: Array<
    | PatchV2WebhooksWebhookIdDollarOrEqualsResponse
    | PatchV2WebhooksWebhookIdDollarOrNotEqualsResponse
  >;
};

/**
 * Filters to determine whether the webhook event should be sent. If null, the filter always passes.
 */
export type PatchV2WebhooksWebhookIdFilterResponseUnion =
  | PatchV2WebhooksWebhookIdFilterResponse1
  | PatchV2WebhooksWebhookIdFilterResponse2;

export type PatchV2WebhooksWebhookIdSubscriptionResponse = {
  /**
   * Type of event the webhook is subscribed to.
   */
  eventType: PatchV2WebhooksWebhookIdEventTypeResponse;
  /**
   * Filters to determine whether the webhook event should be sent. If null, the filter always passes.
   */
  filter:
    | PatchV2WebhooksWebhookIdFilterResponse1
    | PatchV2WebhooksWebhookIdFilterResponse2
    | null;
};

export type PatchV2WebhooksWebhookIdId = {
  /**
   * The ID of the workspace the webhook belongs to.
   */
  workspaceId: string;
  /**
   * The ID of the webhook.
   */
  webhookId: string;
};

/**
 * The state of the webhook. Webhooks marked as active and degraded will receive events, inactive ones will not. If a webhook remains in the degraded state for 7 days, it will be marked inactive.
 */
export const PatchV2WebhooksWebhookIdStatus = {
  Active: "active",
  Degraded: "degraded",
  Inactive: "inactive",
} as const;
/**
 * The state of the webhook. Webhooks marked as active and degraded will receive events, inactive ones will not. If a webhook remains in the degraded state for 7 days, it will be marked inactive.
 */
export type PatchV2WebhooksWebhookIdStatus = ClosedEnum<
  typeof PatchV2WebhooksWebhookIdStatus
>;

export type PatchV2WebhooksWebhookIdDataResponse = {
  /**
   * URL where the webhook events will be delivered to.
   */
  targetUrl: string;
  /**
   * One or more events the webhook is subscribed to.
   */
  subscriptions: Array<PatchV2WebhooksWebhookIdSubscriptionResponse>;
  id: PatchV2WebhooksWebhookIdId;
  /**
   * The state of the webhook. Webhooks marked as active and degraded will receive events, inactive ones will not. If a webhook remains in the degraded state for 7 days, it will be marked inactive.
   */
  status: PatchV2WebhooksWebhookIdStatus;
  /**
   * When the webhook was created.
   */
  createdAt: string;
};

/**
 * Success
 */
export type PatchV2WebhooksWebhookIdResponse = {
  data: PatchV2WebhooksWebhookIdDataResponse;
};

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

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

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

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

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

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

/** @internal */
export const PatchV2WebhooksWebhookIdDollarAndNotEqualsRequest$inboundSchema:
  z.ZodType<
    PatchV2WebhooksWebhookIdDollarAndNotEqualsRequest,
    z.ZodTypeDef,
    unknown
  > = z.object({
    field: z.string(),
    operator:
      PatchV2WebhooksWebhookIdDollarAndOperatorNotEqualsRequest$inboundSchema,
    value: z.string(),
  });

/** @internal */
export type PatchV2WebhooksWebhookIdDollarAndNotEqualsRequest$Outbound = {
  field: string;
  operator: string;
  value: string;
};

/** @internal */
export const PatchV2WebhooksWebhookIdDollarAndNotEqualsRequest$outboundSchema:
  z.ZodType<
    PatchV2WebhooksWebhookIdDollarAndNotEqualsRequest$Outbound,
    z.ZodTypeDef,
    PatchV2WebhooksWebhookIdDollarAndNotEqualsRequest
  > = z.object({
    field: z.string(),
    operator:
      PatchV2WebhooksWebhookIdDollarAndOperatorNotEqualsRequest$outboundSchema,
    value: 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 PatchV2WebhooksWebhookIdDollarAndNotEqualsRequest$ {
  /** @deprecated use `PatchV2WebhooksWebhookIdDollarAndNotEqualsRequest$inboundSchema` instead. */
  export const inboundSchema =
    PatchV2WebhooksWebhookIdDollarAndNotEqualsRequest$inboundSchema;
  /** @deprecated use `PatchV2WebhooksWebhookIdDollarAndNotEqualsRequest$outboundSchema` instead. */
  export const outboundSchema =
    PatchV2WebhooksWebhookIdDollarAndNotEqualsRequest$outboundSchema;
  /** @deprecated use `PatchV2WebhooksWebhookIdDollarAndNotEqualsRequest$Outbound` instead. */
  export type Outbound =
    PatchV2WebhooksWebhookIdDollarAndNotEqualsRequest$Outbound;
}

export function patchV2WebhooksWebhookIdDollarAndNotEqualsRequestToJSON(
  patchV2WebhooksWebhookIdDollarAndNotEqualsRequest:
    PatchV2WebhooksWebhookIdDollarAndNotEqualsRequest,
): string {
  return JSON.stringify(
    PatchV2WebhooksWebhookIdDollarAndNotEqualsRequest$outboundSchema.parse(
      patchV2WebhooksWebhookIdDollarAndNotEqualsRequest,
    ),
  );
}

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

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

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

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

/** @internal */
export const PatchV2WebhooksWebhookIdDollarAndEqualsRequest$inboundSchema:
  z.ZodType<
    PatchV2WebhooksWebhookIdDollarAndEqualsRequest,
    z.ZodTypeDef,
    unknown
  > = z.object({
    field: z.string(),
    operator:
      PatchV2WebhooksWebhookIdDollarAndOperatorEqualsRequest$inboundSchema,
    value: z.string(),
  });

/** @internal */
export type PatchV2WebhooksWebhookIdDollarAndEqualsRequest$Outbound = {
  field: string;
  operator: string;
  value: string;
};

/** @internal */
export const PatchV2WebhooksWebhookIdDollarAndEqualsRequest$outboundSchema:
  z.ZodType<
    PatchV2WebhooksWebhookIdDollarAndEqualsRequest$Outbound,
    z.ZodTypeDef,
    PatchV2WebhooksWebhookIdDollarAndEqualsRequest
  > = z.object({
    field: z.string(),
    operator:
      PatchV2WebhooksWebhookIdDollarAndOperatorEqualsRequest$outboundSchema,
    value: 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 PatchV2WebhooksWebhookIdDollarAndEqualsRequest$ {
  /** @deprecated use `PatchV2WebhooksWebhookIdDollarAndEqualsRequest$inboundSchema` instead. */
  export const inboundSchema =
    PatchV2WebhooksWebhookIdDollarAndEqualsRequest$inboundSchema;
  /** @deprecated use `PatchV2WebhooksWebhookIdDollarAndEqualsRequest$outboundSchema` instead. */
  export const outboundSchema =
    PatchV2WebhooksWebhookIdDollarAndEqualsRequest$outboundSchema;
  /** @deprecated use `PatchV2WebhooksWebhookIdDollarAndEqualsRequest$Outbound` instead. */
  export type Outbound =
    PatchV2WebhooksWebhookIdDollarAndEqualsRequest$Outbound;
}

export function patchV2WebhooksWebhookIdDollarAndEqualsRequestToJSON(
  patchV2WebhooksWebhookIdDollarAndEqualsRequest:
    PatchV2WebhooksWebhookIdDollarAndEqualsRequest,
): string {
  return JSON.stringify(
    PatchV2WebhooksWebhookIdDollarAndEqualsRequest$outboundSchema.parse(
      patchV2WebhooksWebhookIdDollarAndEqualsRequest,
    ),
  );
}

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

/** @internal */
export const PatchV2WebhooksWebhookIdDollarAndRequestUnion$inboundSchema:
  z.ZodType<
    PatchV2WebhooksWebhookIdDollarAndRequestUnion,
    z.ZodTypeDef,
    unknown
  > = z.union([
    z.lazy(() => PatchV2WebhooksWebhookIdDollarAndEqualsRequest$inboundSchema),
    z.lazy(() =>
      PatchV2WebhooksWebhookIdDollarAndNotEqualsRequest$inboundSchema
    ),
  ]);

/** @internal */
export type PatchV2WebhooksWebhookIdDollarAndRequestUnion$Outbound =
  | PatchV2WebhooksWebhookIdDollarAndEqualsRequest$Outbound
  | PatchV2WebhooksWebhookIdDollarAndNotEqualsRequest$Outbound;

/** @internal */
export const PatchV2WebhooksWebhookIdDollarAndRequestUnion$outboundSchema:
  z.ZodType<
    PatchV2WebhooksWebhookIdDollarAndRequestUnion$Outbound,
    z.ZodTypeDef,
    PatchV2WebhooksWebhookIdDollarAndRequestUnion
  > = z.union([
    z.lazy(() => PatchV2WebhooksWebhookIdDollarAndEqualsRequest$outboundSchema),
    z.lazy(() =>
      PatchV2WebhooksWebhookIdDollarAndNotEqualsRequest$outboundSchema
    ),
  ]);

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

export function patchV2WebhooksWebhookIdDollarAndRequestUnionToJSON(
  patchV2WebhooksWebhookIdDollarAndRequestUnion:
    PatchV2WebhooksWebhookIdDollarAndRequestUnion,
): string {
  return JSON.stringify(
    PatchV2WebhooksWebhookIdDollarAndRequestUnion$outboundSchema.parse(
      patchV2WebhooksWebhookIdDollarAndRequestUnion,
    ),
  );
}

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

/** @internal */
export const PatchV2WebhooksWebhookIdFilterRequest2$inboundSchema: z.ZodType<
  PatchV2WebhooksWebhookIdFilterRequest2,
  z.ZodTypeDef,
  unknown
> = z.object({
  $and: z.array(
    z.union([
      z.lazy(() =>
        PatchV2WebhooksWebhookIdDollarAndEqualsRequest$inboundSchema
      ),
      z.lazy(() =>
        PatchV2WebhooksWebhookIdDollarAndNotEqualsRequest$inboundSchema
      ),
    ]),
  ),
}).transform((v) => {
  return remap$(v, {
    "$and": "dollarAnd",
  });
});

/** @internal */
export type PatchV2WebhooksWebhookIdFilterRequest2$Outbound = {
  $and: Array<
    | PatchV2WebhooksWebhookIdDollarAndEqualsRequest$Outbound
    | PatchV2WebhooksWebhookIdDollarAndNotEqualsRequest$Outbound
  >;
};

/** @internal */
export const PatchV2WebhooksWebhookIdFilterRequest2$outboundSchema: z.ZodType<
  PatchV2WebhooksWebhookIdFilterRequest2$Outbound,
  z.ZodTypeDef,
  PatchV2WebhooksWebhookIdFilterRequest2
> = z.object({
  dollarAnd: z.array(
    z.union([
      z.lazy(() =>
        PatchV2WebhooksWebhookIdDollarAndEqualsRequest$outboundSchema
      ),
      z.lazy(() =>
        PatchV2WebhooksWebhookIdDollarAndNotEqualsRequest$outboundSchema
      ),
    ]),
  ),
}).transform((v) => {
  return remap$(v, {
    dollarAnd: "$and",
  });
});

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

export function patchV2WebhooksWebhookIdFilterRequest2ToJSON(
  patchV2WebhooksWebhookIdFilterRequest2:
    PatchV2WebhooksWebhookIdFilterRequest2,
): string {
  return JSON.stringify(
    PatchV2WebhooksWebhookIdFilterRequest2$outboundSchema.parse(
      patchV2WebhooksWebhookIdFilterRequest2,
    ),
  );
}

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

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

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

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

/** @internal */
export const PatchV2WebhooksWebhookIdDollarOrNotEqualsRequest$inboundSchema:
  z.ZodType<
    PatchV2WebhooksWebhookIdDollarOrNotEqualsRequest,
    z.ZodTypeDef,
    unknown
  > = z.object({
    field: z.string(),
    operator:
      PatchV2WebhooksWebhookIdDollarOrOperatorNotEqualsRequest$inboundSchema,
    value: z.string(),
  });

/** @internal */
export type PatchV2WebhooksWebhookIdDollarOrNotEqualsRequest$Outbound = {
  field: string;
  operator: string;
  value: string;
};

/** @internal */
export const PatchV2WebhooksWebhookIdDollarOrNotEqualsRequest$outboundSchema:
  z.ZodType<
    PatchV2WebhooksWebhookIdDollarOrNotEqualsRequest$Outbound,
    z.ZodTypeDef,
    PatchV2WebhooksWebhookIdDollarOrNotEqualsRequest
  > = z.object({
    field: z.string(),
    operator:
      PatchV2WebhooksWebhookIdDollarOrOperatorNotEqualsRequest$outboundSchema,
    value: 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 PatchV2WebhooksWebhookIdDollarOrNotEqualsRequest$ {
  /** @deprecated use `PatchV2WebhooksWebhookIdDollarOrNotEqualsRequest$inboundSchema` instead. */
  export const inboundSchema =
    PatchV2WebhooksWebhookIdDollarOrNotEqualsRequest$inboundSchema;
  /** @deprecated use `PatchV2WebhooksWebhookIdDollarOrNotEqualsRequest$outboundSchema` instead. */
  export const outboundSchema =
    PatchV2WebhooksWebhookIdDollarOrNotEqualsRequest$outboundSchema;
  /** @deprecated use `PatchV2WebhooksWebhookIdDollarOrNotEqualsRequest$Outbound` instead. */
  export type Outbound =
    PatchV2WebhooksWebhookIdDollarOrNotEqualsRequest$Outbound;
}

export function patchV2WebhooksWebhookIdDollarOrNotEqualsRequestToJSON(
  patchV2WebhooksWebhookIdDollarOrNotEqualsRequest:
    PatchV2WebhooksWebhookIdDollarOrNotEqualsRequest,
): string {
  return JSON.stringify(
    PatchV2WebhooksWebhookIdDollarOrNotEqualsRequest$outboundSchema.parse(
      patchV2WebhooksWebhookIdDollarOrNotEqualsRequest,
    ),
  );
}

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

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

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

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

/** @internal */
export const PatchV2WebhooksWebhookIdDollarOrEqualsRequest$inboundSchema:
  z.ZodType<
    PatchV2WebhooksWebhookIdDollarOrEqualsRequest,
    z.ZodTypeDef,
    unknown
  > = z.object({
    field: z.string(),
    operator:
      PatchV2WebhooksWebhookIdDollarOrOperatorEqualsRequest$inboundSchema,
    value: z.string(),
  });

/** @internal */
export type PatchV2WebhooksWebhookIdDollarOrEqualsRequest$Outbound = {
  field: string;
  operator: string;
  value: string;
};

/** @internal */
export const PatchV2WebhooksWebhookIdDollarOrEqualsRequest$outboundSchema:
  z.ZodType<
    PatchV2WebhooksWebhookIdDollarOrEqualsRequest$Outbound,
    z.ZodTypeDef,
    PatchV2WebhooksWebhookIdDollarOrEqualsRequest
  > = z.object({
    field: z.string(),
    operator:
      PatchV2WebhooksWebhookIdDollarOrOperatorEqualsRequest$outboundSchema,
    value: 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 PatchV2WebhooksWebhookIdDollarOrEqualsRequest$ {
  /** @deprecated use `PatchV2WebhooksWebhookIdDollarOrEqualsRequest$inboundSchema` instead. */
  export const inboundSchema =
    PatchV2WebhooksWebhookIdDollarOrEqualsRequest$inboundSchema;
  /** @deprecated use `PatchV2WebhooksWebhookIdDollarOrEqualsRequest$outboundSchema` instead. */
  export const outboundSchema =
    PatchV2WebhooksWebhookIdDollarOrEqualsRequest$outboundSchema;
  /** @deprecated use `PatchV2WebhooksWebhookIdDollarOrEqualsRequest$Outbound` instead. */
  export type Outbound = PatchV2WebhooksWebhookIdDollarOrEqualsRequest$Outbound;
}

export function patchV2WebhooksWebhookIdDollarOrEqualsRequestToJSON(
  patchV2WebhooksWebhookIdDollarOrEqualsRequest:
    PatchV2WebhooksWebhookIdDollarOrEqualsRequest,
): string {
  return JSON.stringify(
    PatchV2WebhooksWebhookIdDollarOrEqualsRequest$outboundSchema.parse(
      patchV2WebhooksWebhookIdDollarOrEqualsRequest,
    ),
  );
}

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

/** @internal */
export const PatchV2WebhooksWebhookIdDollarOrRequestUnion$inboundSchema:
  z.ZodType<
    PatchV2WebhooksWebhookIdDollarOrRequestUnion,
    z.ZodTypeDef,
    unknown
  > = z.union([
    z.lazy(() => PatchV2WebhooksWebhookIdDollarOrEqualsRequest$inboundSchema),
    z.lazy(() =>
      PatchV2WebhooksWebhookIdDollarOrNotEqualsRequest$inboundSchema
    ),
  ]);

/** @internal */
export type PatchV2WebhooksWebhookIdDollarOrRequestUnion$Outbound =
  | PatchV2WebhooksWebhookIdDollarOrEqualsRequest$Outbound
  | PatchV2WebhooksWebhookIdDollarOrNotEqualsRequest$Outbound;

/** @internal */
export const PatchV2WebhooksWebhookIdDollarOrRequestUnion$outboundSchema:
  z.ZodType<
    PatchV2WebhooksWebhookIdDollarOrRequestUnion$Outbound,
    z.ZodTypeDef,
    PatchV2WebhooksWebhookIdDollarOrRequestUnion
  > = z.union([
    z.lazy(() => PatchV2WebhooksWebhookIdDollarOrEqualsRequest$outboundSchema),
    z.lazy(() =>
      PatchV2WebhooksWebhookIdDollarOrNotEqualsRequest$outboundSchema
    ),
  ]);

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

export function patchV2WebhooksWebhookIdDollarOrRequestUnionToJSON(
  patchV2WebhooksWebhookIdDollarOrRequestUnion:
    PatchV2WebhooksWebhookIdDollarOrRequestUnion,
): string {
  return JSON.stringify(
    PatchV2WebhooksWebhookIdDollarOrRequestUnion$outboundSchema.parse(
      patchV2WebhooksWebhookIdDollarOrRequestUnion,
    ),
  );
}

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

/** @internal */
export const PatchV2WebhooksWebhookIdFilterRequest1$inboundSchema: z.ZodType<
  PatchV2WebhooksWebhookIdFilterRequest1,
  z.ZodTypeDef,
  unknown
> = z.object({
  $or: z.array(
    z.union([
      z.lazy(() => PatchV2WebhooksWebhookIdDollarOrEqualsRequest$inboundSchema),
      z.lazy(() =>
        PatchV2WebhooksWebhookIdDollarOrNotEqualsRequest$inboundSchema
      ),
    ]),
  ),
}).transform((v) => {
  return remap$(v, {
    "$or": "dollarOr",
  });
});

/** @internal */
export type PatchV2WebhooksWebhookIdFilterRequest1$Outbound = {
  $or: Array<
    | PatchV2WebhooksWebhookIdDollarOrEqualsRequest$Outbound
    | PatchV2WebhooksWebhookIdDollarOrNotEqualsRequest$Outbound
  >;
};

/** @internal */
export const PatchV2WebhooksWebhookIdFilterRequest1$outboundSchema: z.ZodType<
  PatchV2WebhooksWebhookIdFilterRequest1$Outbound,
  z.ZodTypeDef,
  PatchV2WebhooksWebhookIdFilterRequest1
> = z.object({
  dollarOr: z.array(
    z.union([
      z.lazy(() =>
        PatchV2WebhooksWebhookIdDollarOrEqualsRequest$outboundSchema
      ),
      z.lazy(() =>
        PatchV2WebhooksWebhookIdDollarOrNotEqualsRequest$outboundSchema
      ),
    ]),
  ),
}).transform((v) => {
  return remap$(v, {
    dollarOr: "$or",
  });
});

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

export function patchV2WebhooksWebhookIdFilterRequest1ToJSON(
  patchV2WebhooksWebhookIdFilterRequest1:
    PatchV2WebhooksWebhookIdFilterRequest1,
): string {
  return JSON.stringify(
    PatchV2WebhooksWebhookIdFilterRequest1$outboundSchema.parse(
      patchV2WebhooksWebhookIdFilterRequest1,
    ),
  );
}

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

/** @internal */
export const PatchV2WebhooksWebhookIdFilterRequestUnion$inboundSchema:
  z.ZodType<PatchV2WebhooksWebhookIdFilterRequestUnion, z.ZodTypeDef, unknown> =
    z.union([
      z.lazy(() => PatchV2WebhooksWebhookIdFilterRequest1$inboundSchema),
      z.lazy(() => PatchV2WebhooksWebhookIdFilterRequest2$inboundSchema),
    ]);

/** @internal */
export type PatchV2WebhooksWebhookIdFilterRequestUnion$Outbound =
  | PatchV2WebhooksWebhookIdFilterRequest1$Outbound
  | PatchV2WebhooksWebhookIdFilterRequest2$Outbound;

/** @internal */
export const PatchV2WebhooksWebhookIdFilterRequestUnion$outboundSchema:
  z.ZodType<
    PatchV2WebhooksWebhookIdFilterRequestUnion$Outbound,
    z.ZodTypeDef,
    PatchV2WebhooksWebhookIdFilterRequestUnion
  > = z.union([
    z.lazy(() => PatchV2WebhooksWebhookIdFilterRequest1$outboundSchema),
    z.lazy(() => PatchV2WebhooksWebhookIdFilterRequest2$outboundSchema),
  ]);

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

export function patchV2WebhooksWebhookIdFilterRequestUnionToJSON(
  patchV2WebhooksWebhookIdFilterRequestUnion:
    PatchV2WebhooksWebhookIdFilterRequestUnion,
): string {
  return JSON.stringify(
    PatchV2WebhooksWebhookIdFilterRequestUnion$outboundSchema.parse(
      patchV2WebhooksWebhookIdFilterRequestUnion,
    ),
  );
}

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

/** @internal */
export const PatchV2WebhooksWebhookIdSubscriptionRequest$inboundSchema:
  z.ZodType<
    PatchV2WebhooksWebhookIdSubscriptionRequest,
    z.ZodTypeDef,
    unknown
  > = z.object({
    event_type: PatchV2WebhooksWebhookIdEventTypeRequest$inboundSchema,
    filter: z.nullable(
      z.union([
        z.lazy(() => PatchV2WebhooksWebhookIdFilterRequest1$inboundSchema),
        z.lazy(() => PatchV2WebhooksWebhookIdFilterRequest2$inboundSchema),
      ]),
    ),
  }).transform((v) => {
    return remap$(v, {
      "event_type": "eventType",
    });
  });

/** @internal */
export type PatchV2WebhooksWebhookIdSubscriptionRequest$Outbound = {
  event_type: string;
  filter:
    | PatchV2WebhooksWebhookIdFilterRequest1$Outbound
    | PatchV2WebhooksWebhookIdFilterRequest2$Outbound
    | null;
};

/** @internal */
export const PatchV2WebhooksWebhookIdSubscriptionRequest$outboundSchema:
  z.ZodType<
    PatchV2WebhooksWebhookIdSubscriptionRequest$Outbound,
    z.ZodTypeDef,
    PatchV2WebhooksWebhookIdSubscriptionRequest
  > = z.object({
    eventType: PatchV2WebhooksWebhookIdEventTypeRequest$outboundSchema,
    filter: z.nullable(
      z.union([
        z.lazy(() => PatchV2WebhooksWebhookIdFilterRequest1$outboundSchema),
        z.lazy(() => PatchV2WebhooksWebhookIdFilterRequest2$outboundSchema),
      ]),
    ),
  }).transform((v) => {
    return remap$(v, {
      eventType: "event_type",
    });
  });

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

export function patchV2WebhooksWebhookIdSubscriptionRequestToJSON(
  patchV2WebhooksWebhookIdSubscriptionRequest:
    PatchV2WebhooksWebhookIdSubscriptionRequest,
): string {
  return JSON.stringify(
    PatchV2WebhooksWebhookIdSubscriptionRequest$outboundSchema.parse(
      patchV2WebhooksWebhookIdSubscriptionRequest,
    ),
  );
}

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

/** @internal */
export const PatchV2WebhooksWebhookIdDataRequest$inboundSchema: z.ZodType<
  PatchV2WebhooksWebhookIdDataRequest,
  z.ZodTypeDef,
  unknown
> = z.object({
  target_url: z.string().optional(),
  subscriptions: z.array(
    z.lazy(() => PatchV2WebhooksWebhookIdSubscriptionRequest$inboundSchema),
  ).optional(),
}).transform((v) => {
  return remap$(v, {
    "target_url": "targetUrl",
  });
});

/** @internal */
export type PatchV2WebhooksWebhookIdDataRequest$Outbound = {
  target_url?: string | undefined;
  subscriptions?:
    | Array<PatchV2WebhooksWebhookIdSubscriptionRequest$Outbound>
    | undefined;
};

/** @internal */
export const PatchV2WebhooksWebhookIdDataRequest$outboundSchema: z.ZodType<
  PatchV2WebhooksWebhookIdDataRequest$Outbound,
  z.ZodTypeDef,
  PatchV2WebhooksWebhookIdDataRequest
> = z.object({
  targetUrl: z.string().optional(),
  subscriptions: z.array(
    z.lazy(() => PatchV2WebhooksWebhookIdSubscriptionRequest$outboundSchema),
  ).optional(),
}).transform((v) => {
  return remap$(v, {
    targetUrl: "target_url",
  });
});

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

export function patchV2WebhooksWebhookIdDataRequestToJSON(
  patchV2WebhooksWebhookIdDataRequest: PatchV2WebhooksWebhookIdDataRequest,
): string {
  return JSON.stringify(
    PatchV2WebhooksWebhookIdDataRequest$outboundSchema.parse(
      patchV2WebhooksWebhookIdDataRequest,
    ),
  );
}

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

/** @internal */
export const PatchV2WebhooksWebhookIdRequestBody$inboundSchema: z.ZodType<
  PatchV2WebhooksWebhookIdRequestBody,
  z.ZodTypeDef,
  unknown
> = z.object({
  data: z.lazy(() => PatchV2WebhooksWebhookIdDataRequest$inboundSchema),
});

/** @internal */
export type PatchV2WebhooksWebhookIdRequestBody$Outbound = {
  data: PatchV2WebhooksWebhookIdDataRequest$Outbound;
};

/** @internal */
export const PatchV2WebhooksWebhookIdRequestBody$outboundSchema: z.ZodType<
  PatchV2WebhooksWebhookIdRequestBody$Outbound,
  z.ZodTypeDef,
  PatchV2WebhooksWebhookIdRequestBody
> = z.object({
  data: z.lazy(() => PatchV2WebhooksWebhookIdDataRequest$outboundSchema),
});

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

export function patchV2WebhooksWebhookIdRequestBodyToJSON(
  patchV2WebhooksWebhookIdRequestBody: PatchV2WebhooksWebhookIdRequestBody,
): string {
  return JSON.stringify(
    PatchV2WebhooksWebhookIdRequestBody$outboundSchema.parse(
      patchV2WebhooksWebhookIdRequestBody,
    ),
  );
}

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

/** @internal */
export const PatchV2WebhooksWebhookIdRequest$inboundSchema: z.ZodType<
  PatchV2WebhooksWebhookIdRequest,
  z.ZodTypeDef,
  unknown
> = z.object({
  webhook_id: z.string(),
  RequestBody: z.lazy(() => PatchV2WebhooksWebhookIdRequestBody$inboundSchema),
}).transform((v) => {
  return remap$(v, {
    "webhook_id": "webhookId",
    "RequestBody": "requestBody",
  });
});

/** @internal */
export type PatchV2WebhooksWebhookIdRequest$Outbound = {
  webhook_id: string;
  RequestBody: PatchV2WebhooksWebhookIdRequestBody$Outbound;
};

/** @internal */
export const PatchV2WebhooksWebhookIdRequest$outboundSchema: z.ZodType<
  PatchV2WebhooksWebhookIdRequest$Outbound,
  z.ZodTypeDef,
  PatchV2WebhooksWebhookIdRequest
> = z.object({
  webhookId: z.string(),
  requestBody: z.lazy(() => PatchV2WebhooksWebhookIdRequestBody$outboundSchema),
}).transform((v) => {
  return remap$(v, {
    webhookId: "webhook_id",
    requestBody: "RequestBody",
  });
});

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

export function patchV2WebhooksWebhookIdRequestToJSON(
  patchV2WebhooksWebhookIdRequest: PatchV2WebhooksWebhookIdRequest,
): string {
  return JSON.stringify(
    PatchV2WebhooksWebhookIdRequest$outboundSchema.parse(
      patchV2WebhooksWebhookIdRequest,
    ),
  );
}

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

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

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

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

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

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

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

/** @internal */
export const PatchV2WebhooksWebhookIdDollarAndNotEqualsResponse$inboundSchema:
  z.ZodType<
    PatchV2WebhooksWebhookIdDollarAndNotEqualsResponse,
    z.ZodTypeDef,
    unknown
  > = z.object({
    field: z.string(),
    operator:
      PatchV2WebhooksWebhookIdDollarAndOperatorNotEqualsResponse$inboundSchema,
    value: z.string(),
  });

/** @internal */
export type PatchV2WebhooksWebhookIdDollarAndNotEqualsResponse$Outbound = {
  field: string;
  operator: string;
  value: string;
};

/** @internal */
export const PatchV2WebhooksWebhookIdDollarAndNotEqualsResponse$outboundSchema:
  z.ZodType<
    PatchV2WebhooksWebhookIdDollarAndNotEqualsResponse$Outbound,
    z.ZodTypeDef,
    PatchV2WebhooksWebhookIdDollarAndNotEqualsResponse
  > = z.object({
    field: z.string(),
    operator:
      PatchV2WebhooksWebhookIdDollarAndOperatorNotEqualsResponse$outboundSchema,
    value: 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 PatchV2WebhooksWebhookIdDollarAndNotEqualsResponse$ {
  /** @deprecated use `PatchV2WebhooksWebhookIdDollarAndNotEqualsResponse$inboundSchema` instead. */
  export const inboundSchema =
    PatchV2WebhooksWebhookIdDollarAndNotEqualsResponse$inboundSchema;
  /** @deprecated use `PatchV2WebhooksWebhookIdDollarAndNotEqualsResponse$outboundSchema` instead. */
  export const outboundSchema =
    PatchV2WebhooksWebhookIdDollarAndNotEqualsResponse$outboundSchema;
  /** @deprecated use `PatchV2WebhooksWebhookIdDollarAndNotEqualsResponse$Outbound` instead. */
  export type Outbound =
    PatchV2WebhooksWebhookIdDollarAndNotEqualsResponse$Outbound;
}

export function patchV2WebhooksWebhookIdDollarAndNotEqualsResponseToJSON(
  patchV2WebhooksWebhookIdDollarAndNotEqualsResponse:
    PatchV2WebhooksWebhookIdDollarAndNotEqualsResponse,
): string {
  return JSON.stringify(
    PatchV2WebhooksWebhookIdDollarAndNotEqualsResponse$outboundSchema.parse(
      patchV2WebhooksWebhookIdDollarAndNotEqualsResponse,
    ),
  );
}

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

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

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

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

/** @internal */
export const PatchV2WebhooksWebhookIdDollarAndEqualsResponse$inboundSchema:
  z.ZodType<
    PatchV2WebhooksWebhookIdDollarAndEqualsResponse,
    z.ZodTypeDef,
    unknown
  > = z.object({
    field: z.string(),
    operator:
      PatchV2WebhooksWebhookIdDollarAndOperatorEqualsResponse$inboundSchema,
    value: z.string(),
  });

/** @internal */
export type PatchV2WebhooksWebhookIdDollarAndEqualsResponse$Outbound = {
  field: string;
  operator: string;
  value: string;
};

/** @internal */
export const PatchV2WebhooksWebhookIdDollarAndEqualsResponse$outboundSchema:
  z.ZodType<
    PatchV2WebhooksWebhookIdDollarAndEqualsResponse$Outbound,
    z.ZodTypeDef,
    PatchV2WebhooksWebhookIdDollarAndEqualsResponse
  > = z.object({
    field: z.string(),
    operator:
      PatchV2WebhooksWebhookIdDollarAndOperatorEqualsResponse$outboundSchema,
    value: 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 PatchV2WebhooksWebhookIdDollarAndEqualsResponse$ {
  /** @deprecated use `PatchV2WebhooksWebhookIdDollarAndEqualsResponse$inboundSchema` instead. */
  export const inboundSchema =
    PatchV2WebhooksWebhookIdDollarAndEqualsResponse$inboundSchema;
  /** @deprecated use `PatchV2WebhooksWebhookIdDollarAndEqualsResponse$outboundSchema` instead. */
  export const outboundSchema =
    PatchV2WebhooksWebhookIdDollarAndEqualsResponse$outboundSchema;
  /** @deprecated use `PatchV2WebhooksWebhookIdDollarAndEqualsResponse$Outbound` instead. */
  export type Outbound =
    PatchV2WebhooksWebhookIdDollarAndEqualsResponse$Outbound;
}

export function patchV2WebhooksWebhookIdDollarAndEqualsResponseToJSON(
  patchV2WebhooksWebhookIdDollarAndEqualsResponse:
    PatchV2WebhooksWebhookIdDollarAndEqualsResponse,
): string {
  return JSON.stringify(
    PatchV2WebhooksWebhookIdDollarAndEqualsResponse$outboundSchema.parse(
      patchV2WebhooksWebhookIdDollarAndEqualsResponse,
    ),
  );
}

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

/** @internal */
export const PatchV2WebhooksWebhookIdDollarAndResponseUnion$inboundSchema:
  z.ZodType<
    PatchV2WebhooksWebhookIdDollarAndResponseUnion,
    z.ZodTypeDef,
    unknown
  > = z.union([
    z.lazy(() => PatchV2WebhooksWebhookIdDollarAndEqualsResponse$inboundSchema),
    z.lazy(() =>
      PatchV2WebhooksWebhookIdDollarAndNotEqualsResponse$inboundSchema
    ),
  ]);

/** @internal */
export type PatchV2WebhooksWebhookIdDollarAndResponseUnion$Outbound =
  | PatchV2WebhooksWebhookIdDollarAndEqualsResponse$Outbound
  | PatchV2WebhooksWebhookIdDollarAndNotEqualsResponse$Outbound;

/** @internal */
export const PatchV2WebhooksWebhookIdDollarAndResponseUnion$outboundSchema:
  z.ZodType<
    PatchV2WebhooksWebhookIdDollarAndResponseUnion$Outbound,
    z.ZodTypeDef,
    PatchV2WebhooksWebhookIdDollarAndResponseUnion
  > = z.union([
    z.lazy(() =>
      PatchV2WebhooksWebhookIdDollarAndEqualsResponse$outboundSchema
    ),
    z.lazy(() =>
      PatchV2WebhooksWebhookIdDollarAndNotEqualsResponse$outboundSchema
    ),
  ]);

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

export function patchV2WebhooksWebhookIdDollarAndResponseUnionToJSON(
  patchV2WebhooksWebhookIdDollarAndResponseUnion:
    PatchV2WebhooksWebhookIdDollarAndResponseUnion,
): string {
  return JSON.stringify(
    PatchV2WebhooksWebhookIdDollarAndResponseUnion$outboundSchema.parse(
      patchV2WebhooksWebhookIdDollarAndResponseUnion,
    ),
  );
}

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

/** @internal */
export const PatchV2WebhooksWebhookIdFilterResponse2$inboundSchema: z.ZodType<
  PatchV2WebhooksWebhookIdFilterResponse2,
  z.ZodTypeDef,
  unknown
> = z.object({
  $and: z.array(
    z.union([
      z.lazy(() =>
        PatchV2WebhooksWebhookIdDollarAndEqualsResponse$inboundSchema
      ),
      z.lazy(() =>
        PatchV2WebhooksWebhookIdDollarAndNotEqualsResponse$inboundSchema
      ),
    ]),
  ),
}).transform((v) => {
  return remap$(v, {
    "$and": "dollarAnd",
  });
});

/** @internal */
export type PatchV2WebhooksWebhookIdFilterResponse2$Outbound = {
  $and: Array<
    | PatchV2WebhooksWebhookIdDollarAndEqualsResponse$Outbound
    | PatchV2WebhooksWebhookIdDollarAndNotEqualsResponse$Outbound
  >;
};

/** @internal */
export const PatchV2WebhooksWebhookIdFilterResponse2$outboundSchema: z.ZodType<
  PatchV2WebhooksWebhookIdFilterResponse2$Outbound,
  z.ZodTypeDef,
  PatchV2WebhooksWebhookIdFilterResponse2
> = z.object({
  dollarAnd: z.array(
    z.union([
      z.lazy(() =>
        PatchV2WebhooksWebhookIdDollarAndEqualsResponse$outboundSchema
      ),
      z.lazy(() =>
        PatchV2WebhooksWebhookIdDollarAndNotEqualsResponse$outboundSchema
      ),
    ]),
  ),
}).transform((v) => {
  return remap$(v, {
    dollarAnd: "$and",
  });
});

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

export function patchV2WebhooksWebhookIdFilterResponse2ToJSON(
  patchV2WebhooksWebhookIdFilterResponse2:
    PatchV2WebhooksWebhookIdFilterResponse2,
): string {
  return JSON.stringify(
    PatchV2WebhooksWebhookIdFilterResponse2$outboundSchema.parse(
      patchV2WebhooksWebhookIdFilterResponse2,
    ),
  );
}

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

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

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

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

/** @internal */
export const PatchV2WebhooksWebhookIdDollarOrNotEqualsResponse$inboundSchema:
  z.ZodType<
    PatchV2WebhooksWebhookIdDollarOrNotEqualsResponse,
    z.ZodTypeDef,
    unknown
  > = z.object({
    field: z.string(),
    operator:
      PatchV2WebhooksWebhookIdDollarOrOperatorNotEqualsResponse$inboundSchema,
    value: z.string(),
  });

/** @internal */
export type PatchV2WebhooksWebhookIdDollarOrNotEqualsResponse$Outbound = {
  field: string;
  operator: string;
  value: string;
};

/** @internal */
export const PatchV2WebhooksWebhookIdDollarOrNotEqualsResponse$outboundSchema:
  z.ZodType<
    PatchV2WebhooksWebhookIdDollarOrNotEqualsResponse$Outbound,
    z.ZodTypeDef,
    PatchV2WebhooksWebhookIdDollarOrNotEqualsResponse
  > = z.object({
    field: z.string(),
    operator:
      PatchV2WebhooksWebhookIdDollarOrOperatorNotEqualsResponse$outboundSchema,
    value: 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 PatchV2WebhooksWebhookIdDollarOrNotEqualsResponse$ {
  /** @deprecated use `PatchV2WebhooksWebhookIdDollarOrNotEqualsResponse$inboundSchema` instead. */
  export const inboundSchema =
    PatchV2WebhooksWebhookIdDollarOrNotEqualsResponse$inboundSchema;
  /** @deprecated use `PatchV2WebhooksWebhookIdDollarOrNotEqualsResponse$outboundSchema` instead. */
  export const outboundSchema =
    PatchV2WebhooksWebhookIdDollarOrNotEqualsResponse$outboundSchema;
  /** @deprecated use `PatchV2WebhooksWebhookIdDollarOrNotEqualsResponse$Outbound` instead. */
  export type Outbound =
    PatchV2WebhooksWebhookIdDollarOrNotEqualsResponse$Outbound;
}

export function patchV2WebhooksWebhookIdDollarOrNotEqualsResponseToJSON(
  patchV2WebhooksWebhookIdDollarOrNotEqualsResponse:
    PatchV2WebhooksWebhookIdDollarOrNotEqualsResponse,
): string {
  return JSON.stringify(
    PatchV2WebhooksWebhookIdDollarOrNotEqualsResponse$outboundSchema.parse(
      patchV2WebhooksWebhookIdDollarOrNotEqualsResponse,
    ),
  );
}

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

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

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

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

/** @internal */
export const PatchV2WebhooksWebhookIdDollarOrEqualsResponse$inboundSchema:
  z.ZodType<
    PatchV2WebhooksWebhookIdDollarOrEqualsResponse,
    z.ZodTypeDef,
    unknown
  > = z.object({
    field: z.string(),
    operator:
      PatchV2WebhooksWebhookIdDollarOrOperatorEqualsResponse$inboundSchema,
    value: z.string(),
  });

/** @internal */
export type PatchV2WebhooksWebhookIdDollarOrEqualsResponse$Outbound = {
  field: string;
  operator: string;
  value: string;
};

/** @internal */
export const PatchV2WebhooksWebhookIdDollarOrEqualsResponse$outboundSchema:
  z.ZodType<
    PatchV2WebhooksWebhookIdDollarOrEqualsResponse$Outbound,
    z.ZodTypeDef,
    PatchV2WebhooksWebhookIdDollarOrEqualsResponse
  > = z.object({
    field: z.string(),
    operator:
      PatchV2WebhooksWebhookIdDollarOrOperatorEqualsResponse$outboundSchema,
    value: 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 PatchV2WebhooksWebhookIdDollarOrEqualsResponse$ {
  /** @deprecated use `PatchV2WebhooksWebhookIdDollarOrEqualsResponse$inboundSchema` instead. */
  export const inboundSchema =
    PatchV2WebhooksWebhookIdDollarOrEqualsResponse$inboundSchema;
  /** @deprecated use `PatchV2WebhooksWebhookIdDollarOrEqualsResponse$outboundSchema` instead. */
  export const outboundSchema =
    PatchV2WebhooksWebhookIdDollarOrEqualsResponse$outboundSchema;
  /** @deprecated use `PatchV2WebhooksWebhookIdDollarOrEqualsResponse$Outbound` instead. */
  export type Outbound =
    PatchV2WebhooksWebhookIdDollarOrEqualsResponse$Outbound;
}

export function patchV2WebhooksWebhookIdDollarOrEqualsResponseToJSON(
  patchV2WebhooksWebhookIdDollarOrEqualsResponse:
    PatchV2WebhooksWebhookIdDollarOrEqualsResponse,
): string {
  return JSON.stringify(
    PatchV2WebhooksWebhookIdDollarOrEqualsResponse$outboundSchema.parse(
      patchV2WebhooksWebhookIdDollarOrEqualsResponse,
    ),
  );
}

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

/** @internal */
export const PatchV2WebhooksWebhookIdDollarOrResponseUnion$inboundSchema:
  z.ZodType<
    PatchV2WebhooksWebhookIdDollarOrResponseUnion,
    z.ZodTypeDef,
    unknown
  > = z.union([
    z.lazy(() => PatchV2WebhooksWebhookIdDollarOrEqualsResponse$inboundSchema),
    z.lazy(() =>
      PatchV2WebhooksWebhookIdDollarOrNotEqualsResponse$inboundSchema
    ),
  ]);

/** @internal */
export type PatchV2WebhooksWebhookIdDollarOrResponseUnion$Outbound =
  | PatchV2WebhooksWebhookIdDollarOrEqualsResponse$Outbound
  | PatchV2WebhooksWebhookIdDollarOrNotEqualsResponse$Outbound;

/** @internal */
export const PatchV2WebhooksWebhookIdDollarOrResponseUnion$outboundSchema:
  z.ZodType<
    PatchV2WebhooksWebhookIdDollarOrResponseUnion$Outbound,
    z.ZodTypeDef,
    PatchV2WebhooksWebhookIdDollarOrResponseUnion
  > = z.union([
    z.lazy(() => PatchV2WebhooksWebhookIdDollarOrEqualsResponse$outboundSchema),
    z.lazy(() =>
      PatchV2WebhooksWebhookIdDollarOrNotEqualsResponse$outboundSchema
    ),
  ]);

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

export function patchV2WebhooksWebhookIdDollarOrResponseUnionToJSON(
  patchV2WebhooksWebhookIdDollarOrResponseUnion:
    PatchV2WebhooksWebhookIdDollarOrResponseUnion,
): string {
  return JSON.stringify(
    PatchV2WebhooksWebhookIdDollarOrResponseUnion$outboundSchema.parse(
      patchV2WebhooksWebhookIdDollarOrResponseUnion,
    ),
  );
}

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

/** @internal */
export const PatchV2WebhooksWebhookIdFilterResponse1$inboundSchema: z.ZodType<
  PatchV2WebhooksWebhookIdFilterResponse1,
  z.ZodTypeDef,
  unknown
> = z.object({
  $or: z.array(
    z.union([
      z.lazy(() =>
        PatchV2WebhooksWebhookIdDollarOrEqualsResponse$inboundSchema
      ),
      z.lazy(() =>
        PatchV2WebhooksWebhookIdDollarOrNotEqualsResponse$inboundSchema
      ),
    ]),
  ),
}).transform((v) => {
  return remap$(v, {
    "$or": "dollarOr",
  });
});

/** @internal */
export type PatchV2WebhooksWebhookIdFilterResponse1$Outbound = {
  $or: Array<
    | PatchV2WebhooksWebhookIdDollarOrEqualsResponse$Outbound
    | PatchV2WebhooksWebhookIdDollarOrNotEqualsResponse$Outbound
  >;
};

/** @internal */
export const PatchV2WebhooksWebhookIdFilterResponse1$outboundSchema: z.ZodType<
  PatchV2WebhooksWebhookIdFilterResponse1$Outbound,
  z.ZodTypeDef,
  PatchV2WebhooksWebhookIdFilterResponse1
> = z.object({
  dollarOr: z.array(
    z.union([
      z.lazy(() =>
        PatchV2WebhooksWebhookIdDollarOrEqualsResponse$outboundSchema
      ),
      z.lazy(() =>
        PatchV2WebhooksWebhookIdDollarOrNotEqualsResponse$outboundSchema
      ),
    ]),
  ),
}).transform((v) => {
  return remap$(v, {
    dollarOr: "$or",
  });
});

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

export function patchV2WebhooksWebhookIdFilterResponse1ToJSON(
  patchV2WebhooksWebhookIdFilterResponse1:
    PatchV2WebhooksWebhookIdFilterResponse1,
): string {
  return JSON.stringify(
    PatchV2WebhooksWebhookIdFilterResponse1$outboundSchema.parse(
      patchV2WebhooksWebhookIdFilterResponse1,
    ),
  );
}

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

/** @internal */
export const PatchV2WebhooksWebhookIdFilterResponseUnion$inboundSchema:
  z.ZodType<
    PatchV2WebhooksWebhookIdFilterResponseUnion,
    z.ZodTypeDef,
    unknown
  > = z.union([
    z.lazy(() => PatchV2WebhooksWebhookIdFilterResponse1$inboundSchema),
    z.lazy(() => PatchV2WebhooksWebhookIdFilterResponse2$inboundSchema),
  ]);

/** @internal */
export type PatchV2WebhooksWebhookIdFilterResponseUnion$Outbound =
  | PatchV2WebhooksWebhookIdFilterResponse1$Outbound
  | PatchV2WebhooksWebhookIdFilterResponse2$Outbound;

/** @internal */
export const PatchV2WebhooksWebhookIdFilterResponseUnion$outboundSchema:
  z.ZodType<
    PatchV2WebhooksWebhookIdFilterResponseUnion$Outbound,
    z.ZodTypeDef,
    PatchV2WebhooksWebhookIdFilterResponseUnion
  > = z.union([
    z.lazy(() => PatchV2WebhooksWebhookIdFilterResponse1$outboundSchema),
    z.lazy(() => PatchV2WebhooksWebhookIdFilterResponse2$outboundSchema),
  ]);

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

export function patchV2WebhooksWebhookIdFilterResponseUnionToJSON(
  patchV2WebhooksWebhookIdFilterResponseUnion:
    PatchV2WebhooksWebhookIdFilterResponseUnion,
): string {
  return JSON.stringify(
    PatchV2WebhooksWebhookIdFilterResponseUnion$outboundSchema.parse(
      patchV2WebhooksWebhookIdFilterResponseUnion,
    ),
  );
}

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

/** @internal */
export const PatchV2WebhooksWebhookIdSubscriptionResponse$inboundSchema:
  z.ZodType<
    PatchV2WebhooksWebhookIdSubscriptionResponse,
    z.ZodTypeDef,
    unknown
  > = z.object({
    event_type: PatchV2WebhooksWebhookIdEventTypeResponse$inboundSchema,
    filter: z.nullable(
      z.union([
        z.lazy(() => PatchV2WebhooksWebhookIdFilterResponse1$inboundSchema),
        z.lazy(() => PatchV2WebhooksWebhookIdFilterResponse2$inboundSchema),
      ]),
    ),
  }).transform((v) => {
    return remap$(v, {
      "event_type": "eventType",
    });
  });

/** @internal */
export type PatchV2WebhooksWebhookIdSubscriptionResponse$Outbound = {
  event_type: string;
  filter:
    | PatchV2WebhooksWebhookIdFilterResponse1$Outbound
    | PatchV2WebhooksWebhookIdFilterResponse2$Outbound
    | null;
};

/** @internal */
export const PatchV2WebhooksWebhookIdSubscriptionResponse$outboundSchema:
  z.ZodType<
    PatchV2WebhooksWebhookIdSubscriptionResponse$Outbound,
    z.ZodTypeDef,
    PatchV2WebhooksWebhookIdSubscriptionResponse
  > = z.object({
    eventType: PatchV2WebhooksWebhookIdEventTypeResponse$outboundSchema,
    filter: z.nullable(
      z.union([
        z.lazy(() => PatchV2WebhooksWebhookIdFilterResponse1$outboundSchema),
        z.lazy(() => PatchV2WebhooksWebhookIdFilterResponse2$outboundSchema),
      ]),
    ),
  }).transform((v) => {
    return remap$(v, {
      eventType: "event_type",
    });
  });

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

export function patchV2WebhooksWebhookIdSubscriptionResponseToJSON(
  patchV2WebhooksWebhookIdSubscriptionResponse:
    PatchV2WebhooksWebhookIdSubscriptionResponse,
): string {
  return JSON.stringify(
    PatchV2WebhooksWebhookIdSubscriptionResponse$outboundSchema.parse(
      patchV2WebhooksWebhookIdSubscriptionResponse,
    ),
  );
}

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

/** @internal */
export const PatchV2WebhooksWebhookIdId$inboundSchema: z.ZodType<
  PatchV2WebhooksWebhookIdId,
  z.ZodTypeDef,
  unknown
> = z.object({
  workspace_id: z.string(),
  webhook_id: z.string(),
}).transform((v) => {
  return remap$(v, {
    "workspace_id": "workspaceId",
    "webhook_id": "webhookId",
  });
});

/** @internal */
export type PatchV2WebhooksWebhookIdId$Outbound = {
  workspace_id: string;
  webhook_id: string;
};

/** @internal */
export const PatchV2WebhooksWebhookIdId$outboundSchema: z.ZodType<
  PatchV2WebhooksWebhookIdId$Outbound,
  z.ZodTypeDef,
  PatchV2WebhooksWebhookIdId
> = z.object({
  workspaceId: z.string(),
  webhookId: z.string(),
}).transform((v) => {
  return remap$(v, {
    workspaceId: "workspace_id",
    webhookId: "webhook_id",
  });
});

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

export function patchV2WebhooksWebhookIdIdToJSON(
  patchV2WebhooksWebhookIdId: PatchV2WebhooksWebhookIdId,
): string {
  return JSON.stringify(
    PatchV2WebhooksWebhookIdId$outboundSchema.parse(patchV2WebhooksWebhookIdId),
  );
}

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

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

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

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

/** @internal */
export const PatchV2WebhooksWebhookIdDataResponse$inboundSchema: z.ZodType<
  PatchV2WebhooksWebhookIdDataResponse,
  z.ZodTypeDef,
  unknown
> = z.object({
  target_url: z.string(),
  subscriptions: z.array(
    z.lazy(() => PatchV2WebhooksWebhookIdSubscriptionResponse$inboundSchema),
  ),
  id: z.lazy(() => PatchV2WebhooksWebhookIdId$inboundSchema),
  status: PatchV2WebhooksWebhookIdStatus$inboundSchema,
  created_at: z.string(),
}).transform((v) => {
  return remap$(v, {
    "target_url": "targetUrl",
    "created_at": "createdAt",
  });
});

/** @internal */
export type PatchV2WebhooksWebhookIdDataResponse$Outbound = {
  target_url: string;
  subscriptions: Array<PatchV2WebhooksWebhookIdSubscriptionResponse$Outbound>;
  id: PatchV2WebhooksWebhookIdId$Outbound;
  status: string;
  created_at: string;
};

/** @internal */
export const PatchV2WebhooksWebhookIdDataResponse$outboundSchema: z.ZodType<
  PatchV2WebhooksWebhookIdDataResponse$Outbound,
  z.ZodTypeDef,
  PatchV2WebhooksWebhookIdDataResponse
> = z.object({
  targetUrl: z.string(),
  subscriptions: z.array(
    z.lazy(() => PatchV2WebhooksWebhookIdSubscriptionResponse$outboundSchema),
  ),
  id: z.lazy(() => PatchV2WebhooksWebhookIdId$outboundSchema),
  status: PatchV2WebhooksWebhookIdStatus$outboundSchema,
  createdAt: z.string(),
}).transform((v) => {
  return remap$(v, {
    targetUrl: "target_url",
    createdAt: "created_at",
  });
});

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

export function patchV2WebhooksWebhookIdDataResponseToJSON(
  patchV2WebhooksWebhookIdDataResponse: PatchV2WebhooksWebhookIdDataResponse,
): string {
  return JSON.stringify(
    PatchV2WebhooksWebhookIdDataResponse$outboundSchema.parse(
      patchV2WebhooksWebhookIdDataResponse,
    ),
  );
}

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

/** @internal */
export const PatchV2WebhooksWebhookIdResponse$inboundSchema: z.ZodType<
  PatchV2WebhooksWebhookIdResponse,
  z.ZodTypeDef,
  unknown
> = z.object({
  data: z.lazy(() => PatchV2WebhooksWebhookIdDataResponse$inboundSchema),
});

/** @internal */
export type PatchV2WebhooksWebhookIdResponse$Outbound = {
  data: PatchV2WebhooksWebhookIdDataResponse$Outbound;
};

/** @internal */
export const PatchV2WebhooksWebhookIdResponse$outboundSchema: z.ZodType<
  PatchV2WebhooksWebhookIdResponse$Outbound,
  z.ZodTypeDef,
  PatchV2WebhooksWebhookIdResponse
> = z.object({
  data: z.lazy(() => PatchV2WebhooksWebhookIdDataResponse$outboundSchema),
});

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

export function patchV2WebhooksWebhookIdResponseToJSON(
  patchV2WebhooksWebhookIdResponse: PatchV2WebhooksWebhookIdResponse,
): string {
  return JSON.stringify(
    PatchV2WebhooksWebhookIdResponse$outboundSchema.parse(
      patchV2WebhooksWebhookIdResponse,
    ),
  );
}

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