/*
 * 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 PostV2WebhooksEventTypeRequest = {
  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 PostV2WebhooksEventTypeRequest = ClosedEnum<
  typeof PostV2WebhooksEventTypeRequest
>;

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

export type PostV2WebhooksDollarAndNotEqualsRequest = {
  field: string;
  operator: PostV2WebhooksDollarAndOperatorNotEqualsRequest;
  value: string;
};

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

export type PostV2WebhooksDollarAndEqualsRequest = {
  field: string;
  operator: PostV2WebhooksDollarAndOperatorEqualsRequest;
  value: string;
};

export type PostV2WebhooksDollarAndRequestUnion =
  | PostV2WebhooksDollarAndEqualsRequest
  | PostV2WebhooksDollarAndNotEqualsRequest;

export type PostV2WebhooksFilterRequest2 = {
  dollarAnd: Array<
    | PostV2WebhooksDollarAndEqualsRequest
    | PostV2WebhooksDollarAndNotEqualsRequest
  >;
};

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

export type PostV2WebhooksDollarOrNotEqualsRequest = {
  field: string;
  operator: PostV2WebhooksDollarOrOperatorNotEqualsRequest;
  value: string;
};

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

export type PostV2WebhooksDollarOrEqualsRequest = {
  field: string;
  operator: PostV2WebhooksDollarOrOperatorEqualsRequest;
  value: string;
};

export type PostV2WebhooksDollarOrRequestUnion =
  | PostV2WebhooksDollarOrEqualsRequest
  | PostV2WebhooksDollarOrNotEqualsRequest;

export type PostV2WebhooksFilterRequest1 = {
  dollarOr: Array<
    PostV2WebhooksDollarOrEqualsRequest | PostV2WebhooksDollarOrNotEqualsRequest
  >;
};

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

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

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

export type PostV2WebhooksRequest = {
  data: PostV2WebhooksDataRequest;
};

/**
 * Type of event the webhook is subscribed to.
 */
export const PostV2WebhooksEventTypeResponse = {
  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 PostV2WebhooksEventTypeResponse = ClosedEnum<
  typeof PostV2WebhooksEventTypeResponse
>;

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

export type PostV2WebhooksDollarAndNotEqualsResponse = {
  field: string;
  operator: PostV2WebhooksDollarAndOperatorNotEqualsResponse;
  value: string;
};

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

export type PostV2WebhooksDollarAndEqualsResponse = {
  field: string;
  operator: PostV2WebhooksDollarAndOperatorEqualsResponse;
  value: string;
};

export type PostV2WebhooksDollarAndResponseUnion =
  | PostV2WebhooksDollarAndEqualsResponse
  | PostV2WebhooksDollarAndNotEqualsResponse;

export type PostV2WebhooksFilterResponse2 = {
  dollarAnd: Array<
    | PostV2WebhooksDollarAndEqualsResponse
    | PostV2WebhooksDollarAndNotEqualsResponse
  >;
};

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

export type PostV2WebhooksDollarOrNotEqualsResponse = {
  field: string;
  operator: PostV2WebhooksDollarOrOperatorNotEqualsResponse;
  value: string;
};

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

export type PostV2WebhooksDollarOrEqualsResponse = {
  field: string;
  operator: PostV2WebhooksDollarOrOperatorEqualsResponse;
  value: string;
};

export type PostV2WebhooksDollarOrResponseUnion =
  | PostV2WebhooksDollarOrEqualsResponse
  | PostV2WebhooksDollarOrNotEqualsResponse;

export type PostV2WebhooksFilterResponse1 = {
  dollarOr: Array<
    | PostV2WebhooksDollarOrEqualsResponse
    | PostV2WebhooksDollarOrNotEqualsResponse
  >;
};

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

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

export type PostV2WebhooksId = {
  /**
   * 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 PostV2WebhooksStatus = {
  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 PostV2WebhooksStatus = ClosedEnum<typeof PostV2WebhooksStatus>;

export type PostV2WebhooksDataResponse = {
  /**
   * URL where the webhook events will be delivered to.
   */
  targetUrl: string;
  /**
   * One or more events the webhook is subscribed to.
   */
  subscriptions: Array<PostV2WebhooksSubscriptionResponse>;
  id: PostV2WebhooksId;
  /**
   * 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: PostV2WebhooksStatus;
  /**
   * When the webhook was created.
   */
  createdAt: string;
  /**
   * The key which is used to sign the webhook events. This is only shown when setting up the webhook initially.
   */
  secret: string;
};

/**
 * Success
 */
export type PostV2WebhooksResponse = {
  data: PostV2WebhooksDataResponse;
};

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

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

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

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

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

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

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

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

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

export function postV2WebhooksDollarAndNotEqualsRequestToJSON(
  postV2WebhooksDollarAndNotEqualsRequest:
    PostV2WebhooksDollarAndNotEqualsRequest,
): string {
  return JSON.stringify(
    PostV2WebhooksDollarAndNotEqualsRequest$outboundSchema.parse(
      postV2WebhooksDollarAndNotEqualsRequest,
    ),
  );
}

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

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

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

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

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

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

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

export function postV2WebhooksDollarAndEqualsRequestToJSON(
  postV2WebhooksDollarAndEqualsRequest: PostV2WebhooksDollarAndEqualsRequest,
): string {
  return JSON.stringify(
    PostV2WebhooksDollarAndEqualsRequest$outboundSchema.parse(
      postV2WebhooksDollarAndEqualsRequest,
    ),
  );
}

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

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

/** @internal */
export type PostV2WebhooksDollarAndRequestUnion$Outbound =
  | PostV2WebhooksDollarAndEqualsRequest$Outbound
  | PostV2WebhooksDollarAndNotEqualsRequest$Outbound;

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

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

export function postV2WebhooksDollarAndRequestUnionToJSON(
  postV2WebhooksDollarAndRequestUnion: PostV2WebhooksDollarAndRequestUnion,
): string {
  return JSON.stringify(
    PostV2WebhooksDollarAndRequestUnion$outboundSchema.parse(
      postV2WebhooksDollarAndRequestUnion,
    ),
  );
}

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

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

/** @internal */
export type PostV2WebhooksFilterRequest2$Outbound = {
  $and: Array<
    | PostV2WebhooksDollarAndEqualsRequest$Outbound
    | PostV2WebhooksDollarAndNotEqualsRequest$Outbound
  >;
};

/** @internal */
export const PostV2WebhooksFilterRequest2$outboundSchema: z.ZodType<
  PostV2WebhooksFilterRequest2$Outbound,
  z.ZodTypeDef,
  PostV2WebhooksFilterRequest2
> = z.object({
  dollarAnd: z.array(
    z.union([
      z.lazy(() => PostV2WebhooksDollarAndEqualsRequest$outboundSchema),
      z.lazy(() => PostV2WebhooksDollarAndNotEqualsRequest$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 PostV2WebhooksFilterRequest2$ {
  /** @deprecated use `PostV2WebhooksFilterRequest2$inboundSchema` instead. */
  export const inboundSchema = PostV2WebhooksFilterRequest2$inboundSchema;
  /** @deprecated use `PostV2WebhooksFilterRequest2$outboundSchema` instead. */
  export const outboundSchema = PostV2WebhooksFilterRequest2$outboundSchema;
  /** @deprecated use `PostV2WebhooksFilterRequest2$Outbound` instead. */
  export type Outbound = PostV2WebhooksFilterRequest2$Outbound;
}

export function postV2WebhooksFilterRequest2ToJSON(
  postV2WebhooksFilterRequest2: PostV2WebhooksFilterRequest2,
): string {
  return JSON.stringify(
    PostV2WebhooksFilterRequest2$outboundSchema.parse(
      postV2WebhooksFilterRequest2,
    ),
  );
}

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

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

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

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

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

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

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

export function postV2WebhooksDollarOrNotEqualsRequestToJSON(
  postV2WebhooksDollarOrNotEqualsRequest:
    PostV2WebhooksDollarOrNotEqualsRequest,
): string {
  return JSON.stringify(
    PostV2WebhooksDollarOrNotEqualsRequest$outboundSchema.parse(
      postV2WebhooksDollarOrNotEqualsRequest,
    ),
  );
}

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

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

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

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

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

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

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

export function postV2WebhooksDollarOrEqualsRequestToJSON(
  postV2WebhooksDollarOrEqualsRequest: PostV2WebhooksDollarOrEqualsRequest,
): string {
  return JSON.stringify(
    PostV2WebhooksDollarOrEqualsRequest$outboundSchema.parse(
      postV2WebhooksDollarOrEqualsRequest,
    ),
  );
}

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

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

/** @internal */
export type PostV2WebhooksDollarOrRequestUnion$Outbound =
  | PostV2WebhooksDollarOrEqualsRequest$Outbound
  | PostV2WebhooksDollarOrNotEqualsRequest$Outbound;

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

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

export function postV2WebhooksDollarOrRequestUnionToJSON(
  postV2WebhooksDollarOrRequestUnion: PostV2WebhooksDollarOrRequestUnion,
): string {
  return JSON.stringify(
    PostV2WebhooksDollarOrRequestUnion$outboundSchema.parse(
      postV2WebhooksDollarOrRequestUnion,
    ),
  );
}

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

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

/** @internal */
export type PostV2WebhooksFilterRequest1$Outbound = {
  $or: Array<
    | PostV2WebhooksDollarOrEqualsRequest$Outbound
    | PostV2WebhooksDollarOrNotEqualsRequest$Outbound
  >;
};

/** @internal */
export const PostV2WebhooksFilterRequest1$outboundSchema: z.ZodType<
  PostV2WebhooksFilterRequest1$Outbound,
  z.ZodTypeDef,
  PostV2WebhooksFilterRequest1
> = z.object({
  dollarOr: z.array(
    z.union([
      z.lazy(() => PostV2WebhooksDollarOrEqualsRequest$outboundSchema),
      z.lazy(() => PostV2WebhooksDollarOrNotEqualsRequest$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 PostV2WebhooksFilterRequest1$ {
  /** @deprecated use `PostV2WebhooksFilterRequest1$inboundSchema` instead. */
  export const inboundSchema = PostV2WebhooksFilterRequest1$inboundSchema;
  /** @deprecated use `PostV2WebhooksFilterRequest1$outboundSchema` instead. */
  export const outboundSchema = PostV2WebhooksFilterRequest1$outboundSchema;
  /** @deprecated use `PostV2WebhooksFilterRequest1$Outbound` instead. */
  export type Outbound = PostV2WebhooksFilterRequest1$Outbound;
}

export function postV2WebhooksFilterRequest1ToJSON(
  postV2WebhooksFilterRequest1: PostV2WebhooksFilterRequest1,
): string {
  return JSON.stringify(
    PostV2WebhooksFilterRequest1$outboundSchema.parse(
      postV2WebhooksFilterRequest1,
    ),
  );
}

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

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

/** @internal */
export type PostV2WebhooksFilterRequestUnion$Outbound =
  | PostV2WebhooksFilterRequest1$Outbound
  | PostV2WebhooksFilterRequest2$Outbound;

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

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

export function postV2WebhooksFilterRequestUnionToJSON(
  postV2WebhooksFilterRequestUnion: PostV2WebhooksFilterRequestUnion,
): string {
  return JSON.stringify(
    PostV2WebhooksFilterRequestUnion$outboundSchema.parse(
      postV2WebhooksFilterRequestUnion,
    ),
  );
}

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

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

/** @internal */
export type PostV2WebhooksSubscriptionRequest$Outbound = {
  event_type: string;
  filter:
    | PostV2WebhooksFilterRequest1$Outbound
    | PostV2WebhooksFilterRequest2$Outbound
    | null;
};

/** @internal */
export const PostV2WebhooksSubscriptionRequest$outboundSchema: z.ZodType<
  PostV2WebhooksSubscriptionRequest$Outbound,
  z.ZodTypeDef,
  PostV2WebhooksSubscriptionRequest
> = z.object({
  eventType: PostV2WebhooksEventTypeRequest$outboundSchema,
  filter: z.nullable(
    z.union([
      z.lazy(() => PostV2WebhooksFilterRequest1$outboundSchema),
      z.lazy(() => PostV2WebhooksFilterRequest2$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 PostV2WebhooksSubscriptionRequest$ {
  /** @deprecated use `PostV2WebhooksSubscriptionRequest$inboundSchema` instead. */
  export const inboundSchema = PostV2WebhooksSubscriptionRequest$inboundSchema;
  /** @deprecated use `PostV2WebhooksSubscriptionRequest$outboundSchema` instead. */
  export const outboundSchema =
    PostV2WebhooksSubscriptionRequest$outboundSchema;
  /** @deprecated use `PostV2WebhooksSubscriptionRequest$Outbound` instead. */
  export type Outbound = PostV2WebhooksSubscriptionRequest$Outbound;
}

export function postV2WebhooksSubscriptionRequestToJSON(
  postV2WebhooksSubscriptionRequest: PostV2WebhooksSubscriptionRequest,
): string {
  return JSON.stringify(
    PostV2WebhooksSubscriptionRequest$outboundSchema.parse(
      postV2WebhooksSubscriptionRequest,
    ),
  );
}

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

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

/** @internal */
export type PostV2WebhooksDataRequest$Outbound = {
  target_url: string;
  subscriptions: Array<PostV2WebhooksSubscriptionRequest$Outbound>;
};

/** @internal */
export const PostV2WebhooksDataRequest$outboundSchema: z.ZodType<
  PostV2WebhooksDataRequest$Outbound,
  z.ZodTypeDef,
  PostV2WebhooksDataRequest
> = z.object({
  targetUrl: z.string(),
  subscriptions: z.array(
    z.lazy(() => PostV2WebhooksSubscriptionRequest$outboundSchema),
  ),
}).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 PostV2WebhooksDataRequest$ {
  /** @deprecated use `PostV2WebhooksDataRequest$inboundSchema` instead. */
  export const inboundSchema = PostV2WebhooksDataRequest$inboundSchema;
  /** @deprecated use `PostV2WebhooksDataRequest$outboundSchema` instead. */
  export const outboundSchema = PostV2WebhooksDataRequest$outboundSchema;
  /** @deprecated use `PostV2WebhooksDataRequest$Outbound` instead. */
  export type Outbound = PostV2WebhooksDataRequest$Outbound;
}

export function postV2WebhooksDataRequestToJSON(
  postV2WebhooksDataRequest: PostV2WebhooksDataRequest,
): string {
  return JSON.stringify(
    PostV2WebhooksDataRequest$outboundSchema.parse(postV2WebhooksDataRequest),
  );
}

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

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

/** @internal */
export type PostV2WebhooksRequest$Outbound = {
  data: PostV2WebhooksDataRequest$Outbound;
};

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

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

export function postV2WebhooksRequestToJSON(
  postV2WebhooksRequest: PostV2WebhooksRequest,
): string {
  return JSON.stringify(
    PostV2WebhooksRequest$outboundSchema.parse(postV2WebhooksRequest),
  );
}

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

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

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

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

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

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

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

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

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

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

export function postV2WebhooksDollarAndNotEqualsResponseToJSON(
  postV2WebhooksDollarAndNotEqualsResponse:
    PostV2WebhooksDollarAndNotEqualsResponse,
): string {
  return JSON.stringify(
    PostV2WebhooksDollarAndNotEqualsResponse$outboundSchema.parse(
      postV2WebhooksDollarAndNotEqualsResponse,
    ),
  );
}

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

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

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

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

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

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

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

export function postV2WebhooksDollarAndEqualsResponseToJSON(
  postV2WebhooksDollarAndEqualsResponse: PostV2WebhooksDollarAndEqualsResponse,
): string {
  return JSON.stringify(
    PostV2WebhooksDollarAndEqualsResponse$outboundSchema.parse(
      postV2WebhooksDollarAndEqualsResponse,
    ),
  );
}

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

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

/** @internal */
export type PostV2WebhooksDollarAndResponseUnion$Outbound =
  | PostV2WebhooksDollarAndEqualsResponse$Outbound
  | PostV2WebhooksDollarAndNotEqualsResponse$Outbound;

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

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

export function postV2WebhooksDollarAndResponseUnionToJSON(
  postV2WebhooksDollarAndResponseUnion: PostV2WebhooksDollarAndResponseUnion,
): string {
  return JSON.stringify(
    PostV2WebhooksDollarAndResponseUnion$outboundSchema.parse(
      postV2WebhooksDollarAndResponseUnion,
    ),
  );
}

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

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

/** @internal */
export type PostV2WebhooksFilterResponse2$Outbound = {
  $and: Array<
    | PostV2WebhooksDollarAndEqualsResponse$Outbound
    | PostV2WebhooksDollarAndNotEqualsResponse$Outbound
  >;
};

/** @internal */
export const PostV2WebhooksFilterResponse2$outboundSchema: z.ZodType<
  PostV2WebhooksFilterResponse2$Outbound,
  z.ZodTypeDef,
  PostV2WebhooksFilterResponse2
> = z.object({
  dollarAnd: z.array(
    z.union([
      z.lazy(() => PostV2WebhooksDollarAndEqualsResponse$outboundSchema),
      z.lazy(() => PostV2WebhooksDollarAndNotEqualsResponse$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 PostV2WebhooksFilterResponse2$ {
  /** @deprecated use `PostV2WebhooksFilterResponse2$inboundSchema` instead. */
  export const inboundSchema = PostV2WebhooksFilterResponse2$inboundSchema;
  /** @deprecated use `PostV2WebhooksFilterResponse2$outboundSchema` instead. */
  export const outboundSchema = PostV2WebhooksFilterResponse2$outboundSchema;
  /** @deprecated use `PostV2WebhooksFilterResponse2$Outbound` instead. */
  export type Outbound = PostV2WebhooksFilterResponse2$Outbound;
}

export function postV2WebhooksFilterResponse2ToJSON(
  postV2WebhooksFilterResponse2: PostV2WebhooksFilterResponse2,
): string {
  return JSON.stringify(
    PostV2WebhooksFilterResponse2$outboundSchema.parse(
      postV2WebhooksFilterResponse2,
    ),
  );
}

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

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

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

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

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

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

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

export function postV2WebhooksDollarOrNotEqualsResponseToJSON(
  postV2WebhooksDollarOrNotEqualsResponse:
    PostV2WebhooksDollarOrNotEqualsResponse,
): string {
  return JSON.stringify(
    PostV2WebhooksDollarOrNotEqualsResponse$outboundSchema.parse(
      postV2WebhooksDollarOrNotEqualsResponse,
    ),
  );
}

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

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

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

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

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

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

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

export function postV2WebhooksDollarOrEqualsResponseToJSON(
  postV2WebhooksDollarOrEqualsResponse: PostV2WebhooksDollarOrEqualsResponse,
): string {
  return JSON.stringify(
    PostV2WebhooksDollarOrEqualsResponse$outboundSchema.parse(
      postV2WebhooksDollarOrEqualsResponse,
    ),
  );
}

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

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

/** @internal */
export type PostV2WebhooksDollarOrResponseUnion$Outbound =
  | PostV2WebhooksDollarOrEqualsResponse$Outbound
  | PostV2WebhooksDollarOrNotEqualsResponse$Outbound;

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

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

export function postV2WebhooksDollarOrResponseUnionToJSON(
  postV2WebhooksDollarOrResponseUnion: PostV2WebhooksDollarOrResponseUnion,
): string {
  return JSON.stringify(
    PostV2WebhooksDollarOrResponseUnion$outboundSchema.parse(
      postV2WebhooksDollarOrResponseUnion,
    ),
  );
}

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

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

/** @internal */
export type PostV2WebhooksFilterResponse1$Outbound = {
  $or: Array<
    | PostV2WebhooksDollarOrEqualsResponse$Outbound
    | PostV2WebhooksDollarOrNotEqualsResponse$Outbound
  >;
};

/** @internal */
export const PostV2WebhooksFilterResponse1$outboundSchema: z.ZodType<
  PostV2WebhooksFilterResponse1$Outbound,
  z.ZodTypeDef,
  PostV2WebhooksFilterResponse1
> = z.object({
  dollarOr: z.array(
    z.union([
      z.lazy(() => PostV2WebhooksDollarOrEqualsResponse$outboundSchema),
      z.lazy(() => PostV2WebhooksDollarOrNotEqualsResponse$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 PostV2WebhooksFilterResponse1$ {
  /** @deprecated use `PostV2WebhooksFilterResponse1$inboundSchema` instead. */
  export const inboundSchema = PostV2WebhooksFilterResponse1$inboundSchema;
  /** @deprecated use `PostV2WebhooksFilterResponse1$outboundSchema` instead. */
  export const outboundSchema = PostV2WebhooksFilterResponse1$outboundSchema;
  /** @deprecated use `PostV2WebhooksFilterResponse1$Outbound` instead. */
  export type Outbound = PostV2WebhooksFilterResponse1$Outbound;
}

export function postV2WebhooksFilterResponse1ToJSON(
  postV2WebhooksFilterResponse1: PostV2WebhooksFilterResponse1,
): string {
  return JSON.stringify(
    PostV2WebhooksFilterResponse1$outboundSchema.parse(
      postV2WebhooksFilterResponse1,
    ),
  );
}

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

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

/** @internal */
export type PostV2WebhooksFilterResponseUnion$Outbound =
  | PostV2WebhooksFilterResponse1$Outbound
  | PostV2WebhooksFilterResponse2$Outbound;

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

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

export function postV2WebhooksFilterResponseUnionToJSON(
  postV2WebhooksFilterResponseUnion: PostV2WebhooksFilterResponseUnion,
): string {
  return JSON.stringify(
    PostV2WebhooksFilterResponseUnion$outboundSchema.parse(
      postV2WebhooksFilterResponseUnion,
    ),
  );
}

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

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

/** @internal */
export type PostV2WebhooksSubscriptionResponse$Outbound = {
  event_type: string;
  filter:
    | PostV2WebhooksFilterResponse1$Outbound
    | PostV2WebhooksFilterResponse2$Outbound
    | null;
};

/** @internal */
export const PostV2WebhooksSubscriptionResponse$outboundSchema: z.ZodType<
  PostV2WebhooksSubscriptionResponse$Outbound,
  z.ZodTypeDef,
  PostV2WebhooksSubscriptionResponse
> = z.object({
  eventType: PostV2WebhooksEventTypeResponse$outboundSchema,
  filter: z.nullable(
    z.union([
      z.lazy(() => PostV2WebhooksFilterResponse1$outboundSchema),
      z.lazy(() => PostV2WebhooksFilterResponse2$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 PostV2WebhooksSubscriptionResponse$ {
  /** @deprecated use `PostV2WebhooksSubscriptionResponse$inboundSchema` instead. */
  export const inboundSchema = PostV2WebhooksSubscriptionResponse$inboundSchema;
  /** @deprecated use `PostV2WebhooksSubscriptionResponse$outboundSchema` instead. */
  export const outboundSchema =
    PostV2WebhooksSubscriptionResponse$outboundSchema;
  /** @deprecated use `PostV2WebhooksSubscriptionResponse$Outbound` instead. */
  export type Outbound = PostV2WebhooksSubscriptionResponse$Outbound;
}

export function postV2WebhooksSubscriptionResponseToJSON(
  postV2WebhooksSubscriptionResponse: PostV2WebhooksSubscriptionResponse,
): string {
  return JSON.stringify(
    PostV2WebhooksSubscriptionResponse$outboundSchema.parse(
      postV2WebhooksSubscriptionResponse,
    ),
  );
}

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

/** @internal */
export const PostV2WebhooksId$inboundSchema: z.ZodType<
  PostV2WebhooksId,
  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 PostV2WebhooksId$Outbound = {
  workspace_id: string;
  webhook_id: string;
};

/** @internal */
export const PostV2WebhooksId$outboundSchema: z.ZodType<
  PostV2WebhooksId$Outbound,
  z.ZodTypeDef,
  PostV2WebhooksId
> = 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 PostV2WebhooksId$ {
  /** @deprecated use `PostV2WebhooksId$inboundSchema` instead. */
  export const inboundSchema = PostV2WebhooksId$inboundSchema;
  /** @deprecated use `PostV2WebhooksId$outboundSchema` instead. */
  export const outboundSchema = PostV2WebhooksId$outboundSchema;
  /** @deprecated use `PostV2WebhooksId$Outbound` instead. */
  export type Outbound = PostV2WebhooksId$Outbound;
}

export function postV2WebhooksIdToJSON(
  postV2WebhooksId: PostV2WebhooksId,
): string {
  return JSON.stringify(
    PostV2WebhooksId$outboundSchema.parse(postV2WebhooksId),
  );
}

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

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

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

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

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

/** @internal */
export type PostV2WebhooksDataResponse$Outbound = {
  target_url: string;
  subscriptions: Array<PostV2WebhooksSubscriptionResponse$Outbound>;
  id: PostV2WebhooksId$Outbound;
  status: string;
  created_at: string;
  secret: string;
};

/** @internal */
export const PostV2WebhooksDataResponse$outboundSchema: z.ZodType<
  PostV2WebhooksDataResponse$Outbound,
  z.ZodTypeDef,
  PostV2WebhooksDataResponse
> = z.object({
  targetUrl: z.string(),
  subscriptions: z.array(
    z.lazy(() => PostV2WebhooksSubscriptionResponse$outboundSchema),
  ),
  id: z.lazy(() => PostV2WebhooksId$outboundSchema),
  status: PostV2WebhooksStatus$outboundSchema,
  createdAt: z.string(),
  secret: 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 PostV2WebhooksDataResponse$ {
  /** @deprecated use `PostV2WebhooksDataResponse$inboundSchema` instead. */
  export const inboundSchema = PostV2WebhooksDataResponse$inboundSchema;
  /** @deprecated use `PostV2WebhooksDataResponse$outboundSchema` instead. */
  export const outboundSchema = PostV2WebhooksDataResponse$outboundSchema;
  /** @deprecated use `PostV2WebhooksDataResponse$Outbound` instead. */
  export type Outbound = PostV2WebhooksDataResponse$Outbound;
}

export function postV2WebhooksDataResponseToJSON(
  postV2WebhooksDataResponse: PostV2WebhooksDataResponse,
): string {
  return JSON.stringify(
    PostV2WebhooksDataResponse$outboundSchema.parse(postV2WebhooksDataResponse),
  );
}

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

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

/** @internal */
export type PostV2WebhooksResponse$Outbound = {
  data: PostV2WebhooksDataResponse$Outbound;
};

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

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

export function postV2WebhooksResponseToJSON(
  postV2WebhooksResponse: PostV2WebhooksResponse,
): string {
  return JSON.stringify(
    PostV2WebhooksResponse$outboundSchema.parse(postV2WebhooksResponse),
  );
}

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