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

import * as z from "zod/v3";
import { safeParse } from "../lib/schemas.js";
import { ClosedEnum } from "../types/enums.js";
import { Result as SafeParseResult } from "../types/fp.js";
import * as types from "../types/primitives.js";
import { smartUnion } from "../types/smartUnion.js";
import { SDKValidationError } from "./sdkvalidationerror.js";

/**
 * The payload of the event, if requested.
 */
export type FourHundredAndEight = {
  teamId: string;
  teamName: string;
};

/**
 * The payload of the event, if requested.
 */
export type FourHundredAndSeven = {
  teamName: string;
};

/**
 * The payload of the event, if requested.
 */
export type FourHundredAndSix = {
  username: string;
};

export const UserEventPayload405ActorType = {
  Admin: "admin",
} as const;
export type UserEventPayload405ActorType = ClosedEnum<
  typeof UserEventPayload405ActorType
>;

/**
 * The payload of the event, if requested.
 */
export type FourHundredAndFive = {
  deletedAt?: number | null | undefined;
  username: string;
  /**
   * Okta user id.
   */
  actorId: string;
  actorType: UserEventPayload405ActorType;
  actorName?: string | undefined;
};

/**
 * The payload of the event, if requested.
 */
export type FourHundredAndFour = {
  deletedAt?: number | null | undefined;
  username: string;
};

export const UserEventPayload403ActorType = {
  Admin: "admin",
  User: "user",
} as const;
export type UserEventPayload403ActorType = ClosedEnum<
  typeof UserEventPayload403ActorType
>;

/**
 * The payload of the event, if requested.
 */
export type FourHundredAndThree = {
  totp: boolean;
  recoveryCodes: number;
  actorId?: string | undefined;
  actorType?: UserEventPayload403ActorType | undefined;
  /**
   * Human-readable admin who performed the removal.
   */
  actorName?: string | undefined;
  reason?: string | undefined;
};

/**
 * The payload of the event, if requested.
 */
export type FourHundredAndTwo = {
  teamName?: string | undefined;
};

export const UserEventPayloadReason = {
  LimitsExceeded: "limits-exceeded",
} as const;
export type UserEventPayloadReason = ClosedEnum<typeof UserEventPayloadReason>;

/**
 * The payload of the event, if requested.
 */
export type FourHundredAndOne = {
  reason: UserEventPayloadReason;
};

export const UserEventPayload400Type = {
  HeadSampling: "head_sampling",
} as const;
export type UserEventPayload400Type = ClosedEnum<
  typeof UserEventPayload400Type
>;

export const Env = {
  Preview: "preview",
  Production: "production",
} as const;
export type Env = ClosedEnum<typeof Env>;

export type Sampling = {
  type: UserEventPayload400Type;
  rate: number;
  env?: Env | undefined;
  requestPath?: string | undefined;
};

/**
 * The payload of the event, if requested.
 */
export type FourHundred = {
  projectId: string;
  projectName: string;
  sampling?: Array<Sampling> | undefined;
};

export const UserEventPayload399ActorType = {
  Admin: "admin",
} as const;
export type UserEventPayload399ActorType = ClosedEnum<
  typeof UserEventPayload399ActorType
>;

/**
 * The payload of the event, if requested.
 */
export type ThreeHundredAndNinetyNine = {
  slug?: string | undefined;
  /**
   * Okta user id.
   */
  actorId: string;
  actorType: UserEventPayload399ActorType;
  actorName?: string | undefined;
};

/**
 * The payload of the event, if requested.
 */
export type ThreeHundredAndNinetyEight = {
  slug?: string | undefined;
};

/**
 * The payload of the event, if requested.
 */
export type ThreeHundredAndNinetySeven = {
  fileId: string;
};

/**
 * The payload of the event, if requested.
 */
export type ThreeHundredAndNinetySix = {
  exportId: string;
  from: number;
  to: number;
  format: string;
};

/**
 * The payload of the event, if requested.
 */
export type ThreeHundredAndNinetyFive = {
  tokenTypes: Array<string>;
};

/**
 * The payload of the event, if requested.
 */
export type ThreeHundredAndNinetyFour = {
  domain: string;
  ips: Array<string>;
};

export const Previous2 = {
  Billing: "BILLING",
  Contributor: "CONTRIBUTOR",
  Developer: "DEVELOPER",
  Member: "MEMBER",
  Owner: "OWNER",
  Security: "SECURITY",
  Viewer: "VIEWER",
  ViewerForPlus: "VIEWER_FOR_PLUS",
} as const;
export type Previous2 = ClosedEnum<typeof Previous2>;

export type Previous1 = {
  accessGroupId: string;
};

export type UserEventPayload393Previous = Previous1 | Previous2;

export const Next2 = {
  Billing: "BILLING",
  Contributor: "CONTRIBUTOR",
  Developer: "DEVELOPER",
  Member: "MEMBER",
  Owner: "OWNER",
  Security: "SECURITY",
  Viewer: "VIEWER",
  ViewerForPlus: "VIEWER_FOR_PLUS",
} as const;
export type Next2 = ClosedEnum<typeof Next2>;

export type Next1 = {
  accessGroupId: string;
};

export type UserEventPayload393Next = Next1 | Next2;

/**
 * The payload of the event, if requested.
 */
export type ThreeHundredAndNinetyThree = {
  previous?: { [k: string]: Previous1 | Previous2 } | undefined;
  next?: { [k: string]: Next1 | Next2 } | undefined;
};

export const PayloadScope = {
  Dashboard: "dashboard",
  LogDrains: "log-drains",
} as const;
export type PayloadScope = ClosedEnum<typeof PayloadScope>;

/**
 * The payload of the event, if requested.
 */
export type ThreeHundredAndNinetyTwo = {
  enabled: boolean;
  scope: PayloadScope;
};

export const PayloadEnabled = {
  Default: "default",
  Off: "off",
  On: "on",
} as const;
export type PayloadEnabled = ClosedEnum<typeof PayloadEnabled>;

/**
 * The payload of the event, if requested.
 */
export type ThreeHundredAndNinetyOne = {
  enabled: PayloadEnabled;
};

/**
 * The payload of the event, if requested.
 */
export type ThreeHundredAndNinety = {
  deletedCount: number;
};

/**
 * Represents configuration for remote caching
 */
export type PayloadRemoteCaching = {
  enabled?: boolean | undefined;
};

/**
 * The payload of the event, if requested.
 */
export type ThreeHundredAndEightyNine = {
  /**
   * Represents configuration for remote caching
   */
  remoteCaching?: PayloadRemoteCaching | undefined;
};

export const PayloadConsent = {
  Granted: "granted",
  Refused: "refused",
} as const;
export type PayloadConsent = ClosedEnum<typeof PayloadConsent>;

/**
 * The payload of the event, if requested.
 */
export type ThreeHundredAndEightyEight = {
  consent: PayloadConsent;
};

export const Decision = {
  KeepOn: "keep_on",
  TurnOff: "turn_off",
} as const;
export type Decision = ClosedEnum<typeof Decision>;

/**
 * The payload of the event, if requested.
 */
export type ThreeHundredAndEightySeven = {
  decision: Decision;
  version: string;
};

export const UserEventPayload386ActorType = {
  Admin: "admin",
} as const;
export type UserEventPayload386ActorType = ClosedEnum<
  typeof UserEventPayload386ActorType
>;

/**
 * The payload of the event, if requested.
 */
export type ThreeHundredAndEightySix = {
  name?: string | undefined;
  /**
   * Okta user id.
   */
  actorId: string;
  actorType: UserEventPayload386ActorType;
  actorName?: string | undefined;
};

/**
 * The payload of the event, if requested.
 */
export type ThreeHundredAndEightyFive = {
  name?: string | undefined;
};

/**
 * The payload of the event, if requested.
 */
export type ThreeHundredAndEightyFour = {
  inviteCode?: string | undefined;
};

export const PayloadPlan = {
  Enterprise: "enterprise",
  Hobby: "hobby",
  Pro: "pro",
} as const;
export type PayloadPlan = ClosedEnum<typeof PayloadPlan>;

/**
 * The payload of the event, if requested.
 */
export type ThreeHundredAndEightyThree = {
  invoiceId: string;
  convertedFromTrial: boolean;
  plan: PayloadPlan;
};

export const UserEventPayloadPlan = {
  Enterprise: "enterprise",
  Hobby: "hobby",
  Pro: "pro",
} as const;
export type UserEventPayloadPlan = ClosedEnum<typeof UserEventPayloadPlan>;

export type Trial = {
  start: number;
  end: number;
};

/**
 * The payload of the event, if requested.
 */
export type ThreeHundredAndEightyTwo = {
  plan: UserEventPayloadPlan;
  trial?: Trial | null | undefined;
};

/**
 * The payload of the event, if requested.
 */
export type ThreeHundredAndEightyOne = {
  previousConcurrentBuilds: number;
  nextConcurrentBuilds: number;
};

/**
 * The payload of the event, if requested.
 */
export type ThreeHundredAndEighty = {
  publicId: string;
  name?: string | undefined;
};

/**
 * The payload of the event, if requested.
 */
export type ThreeHundredAndSeventyNine = {
  publicId: string;
  role: string;
  maxUses: number;
  expiresAt: string;
  name?: string | undefined;
};

/**
 * The payload of the event, if requested.
 */
export type ThreeHundredAndSeventyEight = {
  enforced: boolean;
};

/**
 * The payload of the event, if requested.
 */
export type ThreeHundredAndSeventySeven = {
  email?: string | undefined;
  authorized: boolean;
  reason?: string | undefined;
};

export type PayloadUpdatedUser = {
  username: string;
  email: string;
};

export const PreviousTeamRoles = {
  Billing: "BILLING",
  Contributor: "CONTRIBUTOR",
  Developer: "DEVELOPER",
  Member: "MEMBER",
  Owner: "OWNER",
  Security: "SECURITY",
  Viewer: "VIEWER",
  ViewerForPlus: "VIEWER_FOR_PLUS",
} as const;
export type PreviousTeamRoles = ClosedEnum<typeof PreviousTeamRoles>;

export const PayloadTeamRoles = {
  Billing: "BILLING",
  Contributor: "CONTRIBUTOR",
  Developer: "DEVELOPER",
  Member: "MEMBER",
  Owner: "OWNER",
  Security: "SECURITY",
  Viewer: "VIEWER",
  ViewerForPlus: "VIEWER_FOR_PLUS",
} as const;
export type PayloadTeamRoles = ClosedEnum<typeof PayloadTeamRoles>;

export const PreviousTeamPermissions = {
  AiGatewayApiKeyOwnedBySelf: "AiGatewayApiKeyOwnedBySelf",
  AiGatewayBudgetManager: "AiGatewayBudgetManager",
  AiGatewayCredits: "AiGatewayCredits",
  AiGatewaySettings: "AiGatewaySettings",
  AiGatewayTranscriptsManager: "AiGatewayTranscriptsManager",
  AiGatewayTranscriptsViewer: "AiGatewayTranscriptsViewer",
  ConnectorManager: "ConnectorManager",
  CreateProject: "CreateProject",
  EnvVariableManager: "EnvVariableManager",
  EnvironmentManager: "EnvironmentManager",
  FullProductionDeployment: "FullProductionDeployment",
  IntegrationManager: "IntegrationManager",
  OrgAdmin: "OrgAdmin",
  OrgViewer: "OrgViewer",
  UsageViewer: "UsageViewer",
  V0Builder: "V0Builder",
  V0Chatter: "V0Chatter",
  V0Viewer: "V0Viewer",
  WorkflowDecryptor: "WorkflowDecryptor",
} as const;
export type PreviousTeamPermissions = ClosedEnum<
  typeof PreviousTeamPermissions
>;

export const PayloadTeamPermissions = {
  AiGatewayApiKeyOwnedBySelf: "AiGatewayApiKeyOwnedBySelf",
  AiGatewayBudgetManager: "AiGatewayBudgetManager",
  AiGatewayCredits: "AiGatewayCredits",
  AiGatewaySettings: "AiGatewaySettings",
  AiGatewayTranscriptsManager: "AiGatewayTranscriptsManager",
  AiGatewayTranscriptsViewer: "AiGatewayTranscriptsViewer",
  ConnectorManager: "ConnectorManager",
  CreateProject: "CreateProject",
  EnvVariableManager: "EnvVariableManager",
  EnvironmentManager: "EnvironmentManager",
  FullProductionDeployment: "FullProductionDeployment",
  IntegrationManager: "IntegrationManager",
  OrgAdmin: "OrgAdmin",
  OrgViewer: "OrgViewer",
  UsageViewer: "UsageViewer",
  V0Builder: "V0Builder",
  V0Chatter: "V0Chatter",
  V0Viewer: "V0Viewer",
  WorkflowDecryptor: "WorkflowDecryptor",
} as const;
export type PayloadTeamPermissions = ClosedEnum<typeof PayloadTeamPermissions>;

/**
 * The payload of the event, if requested.
 */
export type ThreeHundredAndSeventySix = {
  directoryType?: string | undefined;
  ssoType?: string | undefined;
  updatedUser?: PayloadUpdatedUser | undefined;
  role?: string | undefined;
  previousRole: string;
  previousTeamRoles?: Array<PreviousTeamRoles> | undefined;
  teamRoles?: Array<PayloadTeamRoles> | undefined;
  previousTeamPermissions?: Array<PreviousTeamPermissions> | undefined;
  teamPermissions?: Array<PayloadTeamPermissions> | undefined;
  updatedUid?: string | undefined;
  origin?: string | undefined;
  teamSlug?: string | undefined;
};

export const PayloadSource = {
  AccountUpdate: "account-update",
  Bitbucket: "bitbucket",
  Dsync: "dsync",
  Feedback: "feedback",
  Github: "github",
  Gitlab: "gitlab",
  Import: "import",
  Link: "link",
  Mail: "mail",
  NsnbAutoApprove: "nsnb-auto-approve",
  NsnbHobbyUpgrade: "nsnb-hobby-upgrade",
  NsnbInvite: "nsnb-invite",
  NsnbRedeploy: "nsnb-redeploy",
  NsnbRedeployAttributionCard: "nsnb-redeploy-attribution-card",
  NsnbRequestAccess: "nsnb-request-access",
  NsnbViewerUpgrade: "nsnb-viewer-upgrade",
  OrganizationTeams: "organization-teams",
  Saml: "saml",
  Teams: "teams",
} as const;
export type PayloadSource = ClosedEnum<typeof PayloadSource>;

/**
 * The payload of the event, if requested.
 */
export type ThreeHundredAndSeventyFive = {
  requestedTeamName: string;
  requestedTeamSlug?: string | undefined;
  requestedUserName?: string | undefined;
  gitUsername?: string | undefined;
  githubUsername?: string | undefined;
  gitlabUsername?: string | undefined;
  bitbucketUsername?: string | undefined;
  source?: PayloadSource | undefined;
};

export type UpdatedUser = {
  username: string;
  email: string;
};

export type InvitedBy = {
  email: string;
  userId?: string | undefined;
  name?: string | undefined;
};

/**
 * The payload of the event, if requested.
 */
export type ThreeHundredAndSeventyFour = {
  role?: string | undefined;
  uid?: string | undefined;
  updatedUid?: string | undefined;
  updatedUser?: UpdatedUser | undefined;
  origin?: string | undefined;
  teamSlug?: string | undefined;
  teamRoles?: Array<string> | undefined;
  teamPermissions?: Array<string> | undefined;
  entitlements?: Array<string> | undefined;
  invitedBy?: InvitedBy | undefined;
};

export type UserEventPayload373User = {
  id: string;
  username: string;
};

/**
 * The payload of the event, if requested.
 */
export type ThreeHundredAndSeventyThree = {
  entitlement: string;
  user: UserEventPayload373User;
  previousCanceledAt?: string | undefined;
};

export type UserEventPayloadUser = {
  id: string;
  username: string;
};

/**
 * The payload of the event, if requested.
 */
export type ThreeHundredAndSeventyTwo = {
  entitlement: string;
  user: UserEventPayloadUser;
};

export type PayloadDeletedUser = {
  username: string;
  email: string;
};

export const PayloadRole = {
  Billing: "BILLING",
  Contributor: "CONTRIBUTOR",
  Developer: "DEVELOPER",
  Member: "MEMBER",
  Owner: "OWNER",
  Security: "SECURITY",
  Viewer: "VIEWER",
  ViewerForPlus: "VIEWER_FOR_PLUS",
} as const;
export type PayloadRole = ClosedEnum<typeof PayloadRole>;

export const PreviousPlan = {
  Enterprise: "enterprise",
  Hobby: "hobby",
  Pro: "pro",
} as const;
export type PreviousPlan = ClosedEnum<typeof PreviousPlan>;

export const NewPlan = {
  Enterprise: "enterprise",
  Hobby: "hobby",
  Pro: "pro",
} as const;
export type NewPlan = ClosedEnum<typeof NewPlan>;

/**
 * The payload of the event, if requested.
 */
export type ThreeHundredAndSeventyOne = {
  deletedUser?: PayloadDeletedUser | undefined;
  deletedUid?: string | undefined;
  githubUsername?: string | null | undefined;
  gitlabUsername?: string | null | undefined;
  bitbucketUsername?: string | null | undefined;
  directoryType?: string | undefined;
  role?: PayloadRole | undefined;
  /**
   * Why the member was removed. When removed due to a plan downgrade, this is a {@link DowngradeReason} from `@api/pubsub-types` (e.g. `trial_expired`, `user_downgrade`).
   */
  reason?: string | undefined;
  previousPlan?: PreviousPlan | undefined;
  newPlan?: NewPlan | undefined;
  /**
   * Whether the removal was system-initiated rather than human-initiated.
   */
  automated?: boolean | undefined;
};

/**
 * The payload of the event, if requested.
 */
export type ThreeHundredAndSeventy = {
  teamName: string;
  username?: string | undefined;
  gitUsername?: string | null | undefined;
  githubUsername?: string | null | undefined;
  gitlabUsername?: string | null | undefined;
  bitbucketUsername?: string | null | undefined;
};

/**
 * The payload of the event, if requested.
 */
export type ThreeHundredAndSixtyNine = {
  teamName: string;
  username?: string | undefined;
  gitUsername?: string | undefined;
  githubUsername?: string | null | undefined;
  gitlabUsername?: string | null | undefined;
  bitbucketUsername?: string | null | undefined;
  updatedUid?: string | undefined;
  teamId?: string | undefined;
};

export type InvitedUser = {
  username: string;
  email: string;
};

/**
 * The payload of the event, if requested.
 */
export type ThreeHundredAndSixtyEight = {
  directoryType?: string | undefined;
  ssoType?: string | undefined;
  invitedUser?: InvitedUser | undefined;
  invitedEmail?: string | undefined;
  invitationRole?: string | undefined;
  entitlements?: Array<string> | undefined;
  invitedUid?: string | undefined;
  origin?: string | undefined;
  teamSlug?: string | undefined;
};

/**
 * The payload of the event, if requested.
 */
export type ThreeHundredAndSixtySeven = {
  deletedCount: number;
  inviteIds: Array<string>;
};

/**
 * The payload of the event, if requested.
 */
export type ThreeHundredAndSixtySix = {
  emailDomain?: string | null | undefined;
};

export const UserEventPayloadEnvironment = {
  Preview: "preview",
  Production: "production",
} as const;
export type UserEventPayloadEnvironment = ClosedEnum<
  typeof UserEventPayloadEnvironment
>;

export const Enabled = {
  Default: "default",
  DefaultForce: "default-force",
  Off: "off",
  OffForce: "off-force",
  On: "on",
  OnForce: "on-force",
} as const;
export type Enabled = ClosedEnum<typeof Enabled>;

/**
 * The payload of the event, if requested.
 */
export type ThreeHundredAndSixtyFive = {
  environment: UserEventPayloadEnvironment;
  enabled: Enabled;
};

export const PayloadEnvironment = {
  Preview: "preview",
  Production: "production",
} as const;
export type PayloadEnvironment = ClosedEnum<typeof PayloadEnvironment>;

/**
 * The payload of the event, if requested.
 */
export type ThreeHundredAndSixtyFour = {
  projectId: string;
  projectName: string;
  enabled: boolean | null;
  environment: PayloadEnvironment;
};

/**
 * The payload of the event, if requested.
 */
export type ThreeHundredAndSixtyThree = {
  enabled: boolean;
  domain?: string | undefined;
};

export type UserEventPayload362Previous = {
  gitSources?: Array<any> | null | undefined;
  deploymentSources?: Array<any> | null | undefined;
};

export type UserEventPayload362Next = {
  gitSources?: Array<any> | null | undefined;
  deploymentSources?: Array<any> | null | undefined;
};

/**
 * The payload of the event, if requested.
 */
export type ThreeHundredAndSixtyTwo = {
  previous: UserEventPayload362Previous | null;
  next: UserEventPayload362Next | null;
};

export type Reasons = {
  slug: string;
  description: string;
};

export const UserEventPayload361Role = {
  Billing: "BILLING",
  Contributor: "CONTRIBUTOR",
  Developer: "DEVELOPER",
  Member: "MEMBER",
  Owner: "OWNER",
  Security: "SECURITY",
  Viewer: "VIEWER",
  ViewerForPlus: "VIEWER_FOR_PLUS",
} as const;
export type UserEventPayload361Role = ClosedEnum<
  typeof UserEventPayload361Role
>;

export type UserEventPayloadRemovedUsers = {
  role: UserEventPayload361Role;
  confirmed: boolean;
  confirmedAt?: number | undefined;
};

/**
 * The payload of the event, if requested.
 */
export type ThreeHundredAndSixtyOne = {
  slug: string;
  teamId: string;
  by: string;
  byUid?: string | undefined;
  reasons?: Array<Reasons> | undefined;
  removedUsers?: { [k: string]: UserEventPayloadRemovedUsers } | undefined;
  removedMemberCount?: number | undefined;
  timestamp?: number | undefined;
};

export const UserEventPayload360Previous = {
  Basic: "basic",
  Elastic: "elastic",
  Enhanced: "enhanced",
  Standard: "standard",
  Turbo: "turbo",
} as const;
export type UserEventPayload360Previous = ClosedEnum<
  typeof UserEventPayload360Previous
>;

export const UserEventPayload360Next = {
  Basic: "basic",
  Elastic: "elastic",
  Enhanced: "enhanced",
  Standard: "standard",
  Turbo: "turbo",
} as const;
export type UserEventPayload360Next = ClosedEnum<
  typeof UserEventPayload360Next
>;

export const PayloadReason = {
  BasicFloor: "basic-floor",
  BuildTimeoutFailure: "build-timeout-failure",
  EnospcFailure: "enospc-failure",
  EnterpriseFloor: "enterprise-floor",
  HighPeakDisk: "high-peak-disk",
  HighPeakMemory: "high-peak-memory",
  LongBuildDuration: "long-build-duration",
  OomFailure: "oom-failure",
  PlanChange: "plan-change",
  ProjectTransfer: "project-transfer",
  ShortBuildDuration: "short-build-duration",
  SustainedHighCpu: "sustained-high-cpu",
} as const;
export type PayloadReason = ClosedEnum<typeof PayloadReason>;

/**
 * The payload of the event, if requested.
 */
export type ThreeHundredAndSixty = {
  previous?: UserEventPayload360Previous | undefined;
  next?: UserEventPayload360Next | undefined;
  isSystemInitiated?: boolean | undefined;
  reason?: PayloadReason | undefined;
};

export const UserEventPayload359Previous = {
  AutoApproval: "auto-approval",
  Block: "block",
  ManualApproval: "manual-approval",
} as const;
export type UserEventPayload359Previous = ClosedEnum<
  typeof UserEventPayload359Previous
>;

export const UserEventPayload359Next = {
  AutoApproval: "auto-approval",
  Block: "block",
  ManualApproval: "manual-approval",
} as const;
export type UserEventPayload359Next = ClosedEnum<
  typeof UserEventPayload359Next
>;

/**
 * The payload of the event, if requested.
 */
export type ThreeHundredAndFiftyNine = {
  previous: UserEventPayload359Previous | null;
  next: UserEventPayload359Next | null;
  teamSlug?: string | undefined;
};

/**
 * The payload of the event, if requested.
 */
export type ThreeHundredAndFiftyEight = {
  eventId: string;
  sessionId: string;
  /**
   * Currently emitted session kinds: chat, investigation.
   */
  sessionKind: string;
  /**
   * Currently emitted surfaces: dashboard, internal, slack, automation, github.
   */
  surface: string;
  occurredAt: number;
  planId: string;
  /**
   * Scopes requested by the model-authored plan.
   */
  requestedScopes: Array<string>;
  /**
   * Requested Vercel scopes that are not included in the baseline token.
   */
  elevatedScopes: Array<string>;
  /**
   * Baseline plus elevated Vercel scopes used when minting scoped tokens.
   */
  mergedScopes: Array<string>;
  /**
   * External GitHub scopes requested by the plan; these are not Vercel token scopes.
   */
  githubScopes: Array<string>;
  requestedScopeCount: number;
  elevatedScopeCount: number;
  mergedScopeCount: number;
  githubScopeCount: number;
};

/**
 * The payload of the event, if requested.
 */
export type ThreeHundredAndFiftySeven = {
  eventId: string;
  sessionId: string;
  /**
   * Currently emitted session kinds: chat, investigation.
   */
  sessionKind: string;
  /**
   * Currently emitted surfaces: dashboard, internal, slack, automation, github.
   */
  surface: string;
  occurredAt: number;
};

/**
 * The payload of the event, if requested.
 */
export type ThreeHundredAndFiftySix = {
  trialCreditsIssuedAt: number;
  expiresAt: string;
  amount: string;
  currency: string;
};

/**
 * Which repository visibilities get automatic reviews
 */
export const UserEventPayload355Scope = {
  All: "all",
  Private: "private",
  Public: "public",
  SelectedRepos: "selected_repos",
} as const;
/**
 * Which repository visibilities get automatic reviews
 */
export type UserEventPayload355Scope = ClosedEnum<
  typeof UserEventPayload355Scope
>;

/**
 * Automatic code review settings
 */
export type UserEventPayload355Previous = {
  /**
   * Whether automatic code reviews are enabled
   */
  enabled: boolean;
  /**
   * Which repository visibilities get automatic reviews
   */
  scope: UserEventPayload355Scope;
  /**
   * Whether to include draft pull requests in automatic reviews
   */
  includeDrafts: boolean;
  /**
   * GitHub repos to scope automatic reviews to. Format: "owner/repo" (lowercase). Only used when scope='selected_repos'.
   */
  selectedRepos?: Array<string> | null | undefined;
};

/**
 * Which repository visibilities get automatic reviews
 */
export const UserEventPayload355NextScope = {
  All: "all",
  Private: "private",
  Public: "public",
  SelectedRepos: "selected_repos",
} as const;
/**
 * Which repository visibilities get automatic reviews
 */
export type UserEventPayload355NextScope = ClosedEnum<
  typeof UserEventPayload355NextScope
>;

/**
 * Automatic code review settings
 */
export type UserEventPayload355Next = {
  /**
   * Whether automatic code reviews are enabled
   */
  enabled: boolean;
  /**
   * Which repository visibilities get automatic reviews
   */
  scope: UserEventPayload355NextScope;
  /**
   * Whether to include draft pull requests in automatic reviews
   */
  includeDrafts: boolean;
  /**
   * GitHub repos to scope automatic reviews to. Format: "owner/repo" (lowercase). Only used when scope='selected_repos'.
   */
  selectedRepos?: Array<string> | null | undefined;
};

/**
 * The payload of the event, if requested.
 */
export type ThreeHundredAndFiftyFive = {
  /**
   * Automatic code review settings
   */
  previous?: UserEventPayload355Previous | undefined;
  /**
   * Automatic code review settings
   */
  next: UserEventPayload355Next;
};

/**
 * The payload of the event, if requested.
 */
export type ThreeHundredAndFiftyFour = {
  slug: string;
};

export const UserEventPayload353ActorType = {
  Admin: "admin",
  User: "user",
} as const;
export type UserEventPayload353ActorType = ClosedEnum<
  typeof UserEventPayload353ActorType
>;

/**
 * The payload of the event, if requested.
 */
export type ThreeHundredAndFiftyThree = {
  actorId?: string | undefined;
  actorType?: UserEventPayload353ActorType | undefined;
  reason?: string | undefined;
  caseNumber?: string | undefined;
  client?: string | undefined;
};

export const UserEventPayload352Type = {
  Blob: "blob",
  EdgeConfig: "edge-config",
  Integration: "integration",
  Postgres: "postgres",
  Redis: "redis",
} as const;
export type UserEventPayload352Type = ClosedEnum<
  typeof UserEventPayload352Type
>;

export const PayloadAccess = {
  Private: "private",
  Public: "public",
} as const;
export type PayloadAccess = ClosedEnum<typeof PayloadAccess>;

/**
 * The payload of the event, if requested.
 */
export type ThreeHundredAndFiftyTwo = {
  id: string;
  name?: string | undefined;
  computeUnitsMax?: number | undefined;
  computeUnitsMin?: number | undefined;
  suspendTimeoutSeconds?: number | undefined;
  type: UserEventPayload352Type;
  access?: PayloadAccess | undefined;
  locked: boolean;
};

export type UserEventPayload351Store = {
  name: string;
  id: string;
};

/**
 * The payload of the event, if requested.
 */
export type ThreeHundredAndFiftyOne = {
  store: UserEventPayload351Store;
  ownerId?: string | undefined;
};

export const UserEventPayload350Type = {
  Blob: "blob",
  EdgeConfig: "edge-config",
  Integration: "integration",
  Postgres: "postgres",
  Redis: "redis",
} as const;
export type UserEventPayload350Type = ClosedEnum<
  typeof UserEventPayload350Type
>;

export const Access = {
  Private: "private",
  Public: "public",
} as const;
export type Access = ClosedEnum<typeof Access>;

/**
 * The payload of the event, if requested.
 */
export type ThreeHundredAndFifty = {
  id: string;
  name?: string | undefined;
  computeUnitsMax?: number | undefined;
  computeUnitsMin?: number | undefined;
  suspendTimeoutSeconds?: number | undefined;
  type: UserEventPayload350Type;
  access?: Access | undefined;
};

export const UserEventPayload349Type = {
  Blob: "blob",
  EdgeConfig: "edge-config",
  Integration: "integration",
  Postgres: "postgres",
  Redis: "redis",
} as const;
export type UserEventPayload349Type = ClosedEnum<
  typeof UserEventPayload349Type
>;

export type UserEventPayloadStore = {
  id: string;
  name?: string | undefined;
  type: UserEventPayload349Type;
};

/**
 * The payload of the event, if requested.
 */
export type ThreeHundredAndFortyNine = {
  transferRequestCode: string;
  store: UserEventPayloadStore;
  originTeamId: string;
  originTeamName: string;
};

export const UserEventPayload348Type = {
  Blob: "blob",
  EdgeConfig: "edge-config",
  Integration: "integration",
  Postgres: "postgres",
  Redis: "redis",
} as const;
export type UserEventPayload348Type = ClosedEnum<
  typeof UserEventPayload348Type
>;

export type PayloadStore = {
  id: string;
  name?: string | undefined;
  type: UserEventPayload348Type;
};

/**
 * The payload of the event, if requested.
 */
export type ThreeHundredAndFortyEight = {
  transferRequestCode: string;
  store: PayloadStore;
  destinationTeamId: string;
  destinationTeamName: string;
};

export const UserEventPayload347Type = {
  Blob: "blob",
  EdgeConfig: "edge-config",
  Integration: "integration",
  Postgres: "postgres",
  Redis: "redis",
} as const;
export type UserEventPayload347Type = ClosedEnum<
  typeof UserEventPayload347Type
>;

export type Store = {
  id: string;
  name?: string | undefined;
  type: UserEventPayload347Type;
};

/**
 * The payload of the event, if requested.
 */
export type ThreeHundredAndFortySeven = {
  transferRequestCode: string;
  store: Store;
};

export const StoreType = {
  Postgres: "postgres",
  Redis: "redis",
} as const;
export type StoreType = ClosedEnum<typeof StoreType>;

/**
 * The payload of the event, if requested.
 */
export type ThreeHundredAndFortySix = {
  storeType: StoreType;
};

/**
 * The payload of the event, if requested.
 */
export type ThreeHundredAndFortyFive = {
  webhookUrl?: string | undefined;
};

/**
 * The budget type
 */
export const UserEventPayload344Type = {
  Fixed: "fixed",
} as const;
/**
 * The budget type
 */
export type UserEventPayload344Type = ClosedEnum<
  typeof UserEventPayload344Type
>;

/**
 * The acive pricing plan the team is billed with
 */
export const UserEventPayloadPricingPlan = {
  Flex: "flex",
  Legacy: "legacy",
  Platform: "platform",
  Plus: "plus",
  Unbundled: "unbundled",
} as const;
/**
 * The acive pricing plan the team is billed with
 */
export type UserEventPayloadPricingPlan = ClosedEnum<
  typeof UserEventPayloadPricingPlan
>;

/**
 * Which budget this is. Matches Copper SDK `BudgetScope`. Omitted on events published before team/org/project scopes existed (treat as team).
 */
export const UserEventPayload344Scope = {
  Organization: "organization",
  Project: "project",
  Team: "team",
} as const;
/**
 * Which budget this is. Matches Copper SDK `BudgetScope`. Omitted on events published before team/org/project scopes existed (treat as team).
 */
export type UserEventPayload344Scope = ClosedEnum<
  typeof UserEventPayload344Scope
>;

/**
 * Represents a budget for tracking and notifying teams on their spending.
 */
export type UserEventPayload344Budget = {
  /**
   * The budget type
   */
  type: UserEventPayload344Type;
  /**
   * Budget amount (USD / dollars)
   */
  fixedBudget: number;
  /**
   * Array of the last 3 months of spend data
   */
  previousSpend: Array<number>;
  /**
   * Array of 50, 75, 100 to keep track of notifications sent out
   */
  notifiedAt: Array<number>;
  /**
   * Webhook id that corresponds to a webhook in Cosmos webhook collection
   */
  webhookId?: string | undefined;
  /**
   * Keep track if the webhook has been called for the month
   */
  webhookNotified?: boolean | undefined;
  /**
   * Date time when budget is created
   */
  createdAt: number;
  /**
   * Date time when budget is updated last
   */
  updatedAt?: number | undefined;
  /**
   * Is the budget currently active for a customer
   */
  isActive: boolean;
  /**
   * Should all projects be paused if budget is exceeded
   */
  pauseProjects?: boolean | undefined;
  /**
   * The acive pricing plan the team is billed with
   */
  pricingPlan?: UserEventPayloadPricingPlan | undefined;
  /**
   * Which budget this is. Matches Copper SDK `BudgetScope`. Omitted on events published before team/org/project scopes existed (treat as team).
   */
  scope?: UserEventPayload344Scope | undefined;
  /**
   * Project id when `scope` is `project`.
   */
  scopeId?: string | undefined;
  /**
   * Partition key
   */
  teamId: string;
  /**
   * Sort key that needs to be unique per teamId
   */
  id: string;
};

/**
 * The budget type
 */
export const UserEventPayload344PrevBudgetType = {
  Fixed: "fixed",
} as const;
/**
 * The budget type
 */
export type UserEventPayload344PrevBudgetType = ClosedEnum<
  typeof UserEventPayload344PrevBudgetType
>;

/**
 * The acive pricing plan the team is billed with
 */
export const UserEventPayload344PricingPlan = {
  Flex: "flex",
  Legacy: "legacy",
  Platform: "platform",
  Plus: "plus",
  Unbundled: "unbundled",
} as const;
/**
 * The acive pricing plan the team is billed with
 */
export type UserEventPayload344PricingPlan = ClosedEnum<
  typeof UserEventPayload344PricingPlan
>;

/**
 * Which budget this is. Matches Copper SDK `BudgetScope`. Omitted on events published before team/org/project scopes existed (treat as team).
 */
export const UserEventPayload344PrevBudgetScope = {
  Organization: "organization",
  Project: "project",
  Team: "team",
} as const;
/**
 * Which budget this is. Matches Copper SDK `BudgetScope`. Omitted on events published before team/org/project scopes existed (treat as team).
 */
export type UserEventPayload344PrevBudgetScope = ClosedEnum<
  typeof UserEventPayload344PrevBudgetScope
>;

/**
 * Represents a budget for tracking and notifying teams on their spending.
 */
export type PrevBudget = {
  /**
   * The budget type
   */
  type: UserEventPayload344PrevBudgetType;
  /**
   * Budget amount (USD / dollars)
   */
  fixedBudget: number;
  /**
   * Array of the last 3 months of spend data
   */
  previousSpend: Array<number>;
  /**
   * Array of 50, 75, 100 to keep track of notifications sent out
   */
  notifiedAt: Array<number>;
  /**
   * Webhook id that corresponds to a webhook in Cosmos webhook collection
   */
  webhookId?: string | undefined;
  /**
   * Keep track if the webhook has been called for the month
   */
  webhookNotified?: boolean | undefined;
  /**
   * Date time when budget is created
   */
  createdAt: number;
  /**
   * Date time when budget is updated last
   */
  updatedAt?: number | undefined;
  /**
   * Is the budget currently active for a customer
   */
  isActive: boolean;
  /**
   * Should all projects be paused if budget is exceeded
   */
  pauseProjects?: boolean | undefined;
  /**
   * The acive pricing plan the team is billed with
   */
  pricingPlan?: UserEventPayload344PricingPlan | undefined;
  /**
   * Which budget this is. Matches Copper SDK `BudgetScope`. Omitted on events published before team/org/project scopes existed (treat as team).
   */
  scope?: UserEventPayload344PrevBudgetScope | undefined;
  /**
   * Project id when `scope` is `project`.
   */
  scopeId?: string | undefined;
  /**
   * Partition key
   */
  teamId: string;
  /**
   * Sort key that needs to be unique per teamId
   */
  id: string;
};

/**
 * The payload of the event, if requested.
 */
export type ThreeHundredAndFortyFour = {
  /**
   * Represents a budget for tracking and notifying teams on their spending.
   */
  budget: UserEventPayload344Budget;
  /**
   * Represents a budget for tracking and notifying teams on their spending.
   */
  prevBudget?: PrevBudget | undefined;
  webhookUrl?: string | undefined;
  prevWebhookUrl?: string | undefined;
};

/**
 * The budget type
 */
export const UserEventPayload343Type = {
  Fixed: "fixed",
} as const;
/**
 * The budget type
 */
export type UserEventPayload343Type = ClosedEnum<
  typeof UserEventPayload343Type
>;

/**
 * The acive pricing plan the team is billed with
 */
export const PayloadPricingPlan = {
  Flex: "flex",
  Legacy: "legacy",
  Platform: "platform",
  Plus: "plus",
  Unbundled: "unbundled",
} as const;
/**
 * The acive pricing plan the team is billed with
 */
export type PayloadPricingPlan = ClosedEnum<typeof PayloadPricingPlan>;

/**
 * Which budget this is. Matches Copper SDK `BudgetScope`. Omitted on events published before team/org/project scopes existed (treat as team).
 */
export const UserEventPayload343Scope = {
  Organization: "organization",
  Project: "project",
  Team: "team",
} as const;
/**
 * Which budget this is. Matches Copper SDK `BudgetScope`. Omitted on events published before team/org/project scopes existed (treat as team).
 */
export type UserEventPayload343Scope = ClosedEnum<
  typeof UserEventPayload343Scope
>;

/**
 * Represents a budget for tracking and notifying teams on their spending.
 */
export type UserEventPayload343Budget = {
  /**
   * The budget type
   */
  type: UserEventPayload343Type;
  /**
   * Budget amount (USD / dollars)
   */
  fixedBudget: number;
  /**
   * Array of the last 3 months of spend data
   */
  previousSpend: Array<number>;
  /**
   * Array of 50, 75, 100 to keep track of notifications sent out
   */
  notifiedAt: Array<number>;
  /**
   * Webhook id that corresponds to a webhook in Cosmos webhook collection
   */
  webhookId?: string | undefined;
  /**
   * Keep track if the webhook has been called for the month
   */
  webhookNotified?: boolean | undefined;
  /**
   * Date time when budget is created
   */
  createdAt: number;
  /**
   * Date time when budget is updated last
   */
  updatedAt?: number | undefined;
  /**
   * Is the budget currently active for a customer
   */
  isActive: boolean;
  /**
   * Should all projects be paused if budget is exceeded
   */
  pauseProjects?: boolean | undefined;
  /**
   * The acive pricing plan the team is billed with
   */
  pricingPlan?: PayloadPricingPlan | undefined;
  /**
   * Which budget this is. Matches Copper SDK `BudgetScope`. Omitted on events published before team/org/project scopes existed (treat as team).
   */
  scope?: UserEventPayload343Scope | undefined;
  /**
   * Project id when `scope` is `project`.
   */
  scopeId?: string | undefined;
  /**
   * Partition key
   */
  teamId: string;
  /**
   * Sort key that needs to be unique per teamId
   */
  id: string;
};

/**
 * The payload of the event, if requested.
 */
export type ThreeHundredAndFortyThree = {
  /**
   * Represents a budget for tracking and notifying teams on their spending.
   */
  budget: UserEventPayload343Budget;
  webhookUrl?: string | undefined;
};

/**
 * The budget type
 */
export const UserEventPayload342Type = {
  Fixed: "fixed",
} as const;
/**
 * The budget type
 */
export type UserEventPayload342Type = ClosedEnum<
  typeof UserEventPayload342Type
>;

/**
 * The acive pricing plan the team is billed with
 */
export const PricingPlan = {
  Flex: "flex",
  Legacy: "legacy",
  Platform: "platform",
  Plus: "plus",
  Unbundled: "unbundled",
} as const;
/**
 * The acive pricing plan the team is billed with
 */
export type PricingPlan = ClosedEnum<typeof PricingPlan>;

/**
 * Which budget this is. Matches Copper SDK `BudgetScope`. Omitted on events published before team/org/project scopes existed (treat as team).
 */
export const UserEventPayload342Scope = {
  Organization: "organization",
  Project: "project",
  Team: "team",
} as const;
/**
 * Which budget this is. Matches Copper SDK `BudgetScope`. Omitted on events published before team/org/project scopes existed (treat as team).
 */
export type UserEventPayload342Scope = ClosedEnum<
  typeof UserEventPayload342Scope
>;

/**
 * Represents a budget for tracking and notifying teams on their spending.
 */
export type UserEventPayload342Budget = {
  /**
   * The budget type
   */
  type: UserEventPayload342Type;
  /**
   * Budget amount (USD / dollars)
   */
  fixedBudget: number;
  /**
   * Array of the last 3 months of spend data
   */
  previousSpend: Array<number>;
  /**
   * Array of 50, 75, 100 to keep track of notifications sent out
   */
  notifiedAt: Array<number>;
  /**
   * Webhook id that corresponds to a webhook in Cosmos webhook collection
   */
  webhookId?: string | undefined;
  /**
   * Keep track if the webhook has been called for the month
   */
  webhookNotified?: boolean | undefined;
  /**
   * Date time when budget is created
   */
  createdAt: number;
  /**
   * Date time when budget is updated last
   */
  updatedAt?: number | undefined;
  /**
   * Is the budget currently active for a customer
   */
  isActive: boolean;
  /**
   * Should all projects be paused if budget is exceeded
   */
  pauseProjects?: boolean | undefined;
  /**
   * The acive pricing plan the team is billed with
   */
  pricingPlan?: PricingPlan | undefined;
  /**
   * Which budget this is. Matches Copper SDK `BudgetScope`. Omitted on events published before team/org/project scopes existed (treat as team).
   */
  scope?: UserEventPayload342Scope | undefined;
  /**
   * Project id when `scope` is `project`.
   */
  scopeId?: string | undefined;
  /**
   * Partition key
   */
  teamId: string;
  /**
   * Sort key that needs to be unique per teamId
   */
  id: string;
};

/**
 * The payload of the event, if requested.
 */
export type ThreeHundredAndFortyTwo = {
  /**
   * Represents a budget for tracking and notifying teams on their spending.
   */
  budget: UserEventPayload342Budget;
};

/** @internal */
export const FourHundredAndEight$inboundSchema: z.ZodType<
  FourHundredAndEight,
  z.ZodTypeDef,
  unknown
> = z.object({
  teamId: types.string(),
  teamName: types.string(),
});

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

/** @internal */
export const FourHundredAndSeven$inboundSchema: z.ZodType<
  FourHundredAndSeven,
  z.ZodTypeDef,
  unknown
> = z.object({
  teamName: types.string(),
});

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

/** @internal */
export const FourHundredAndSix$inboundSchema: z.ZodType<
  FourHundredAndSix,
  z.ZodTypeDef,
  unknown
> = z.object({
  username: types.string(),
});

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

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

/** @internal */
export const FourHundredAndFive$inboundSchema: z.ZodType<
  FourHundredAndFive,
  z.ZodTypeDef,
  unknown
> = z.object({
  deletedAt: z.nullable(types.number()).optional(),
  username: types.string(),
  actorId: types.string(),
  actorType: UserEventPayload405ActorType$inboundSchema,
  actorName: types.optional(types.string()),
});

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

/** @internal */
export const FourHundredAndFour$inboundSchema: z.ZodType<
  FourHundredAndFour,
  z.ZodTypeDef,
  unknown
> = z.object({
  deletedAt: z.nullable(types.number()).optional(),
  username: types.string(),
});

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

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

/** @internal */
export const FourHundredAndThree$inboundSchema: z.ZodType<
  FourHundredAndThree,
  z.ZodTypeDef,
  unknown
> = z.object({
  totp: types.boolean(),
  recoveryCodes: types.number(),
  actorId: types.optional(types.string()),
  actorType: types.optional(UserEventPayload403ActorType$inboundSchema),
  actorName: types.optional(types.string()),
  reason: types.optional(types.string()),
});

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

/** @internal */
export const FourHundredAndTwo$inboundSchema: z.ZodType<
  FourHundredAndTwo,
  z.ZodTypeDef,
  unknown
> = z.object({
  teamName: types.optional(types.string()),
});

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

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

/** @internal */
export const FourHundredAndOne$inboundSchema: z.ZodType<
  FourHundredAndOne,
  z.ZodTypeDef,
  unknown
> = z.object({
  reason: UserEventPayloadReason$inboundSchema,
});

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

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

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

/** @internal */
export const Sampling$inboundSchema: z.ZodType<
  Sampling,
  z.ZodTypeDef,
  unknown
> = z.object({
  type: UserEventPayload400Type$inboundSchema,
  rate: types.number(),
  env: types.optional(Env$inboundSchema),
  requestPath: types.optional(types.string()),
});

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

/** @internal */
export const FourHundred$inboundSchema: z.ZodType<
  FourHundred,
  z.ZodTypeDef,
  unknown
> = z.object({
  projectId: types.string(),
  projectName: types.string(),
  sampling: types.optional(z.array(z.lazy(() => Sampling$inboundSchema))),
});

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

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

/** @internal */
export const ThreeHundredAndNinetyNine$inboundSchema: z.ZodType<
  ThreeHundredAndNinetyNine,
  z.ZodTypeDef,
  unknown
> = z.object({
  slug: types.optional(types.string()),
  actorId: types.string(),
  actorType: UserEventPayload399ActorType$inboundSchema,
  actorName: types.optional(types.string()),
});

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

/** @internal */
export const ThreeHundredAndNinetyEight$inboundSchema: z.ZodType<
  ThreeHundredAndNinetyEight,
  z.ZodTypeDef,
  unknown
> = z.object({
  slug: types.optional(types.string()),
});

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

/** @internal */
export const ThreeHundredAndNinetySeven$inboundSchema: z.ZodType<
  ThreeHundredAndNinetySeven,
  z.ZodTypeDef,
  unknown
> = z.object({
  fileId: types.string(),
});

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

/** @internal */
export const ThreeHundredAndNinetySix$inboundSchema: z.ZodType<
  ThreeHundredAndNinetySix,
  z.ZodTypeDef,
  unknown
> = z.object({
  exportId: types.string(),
  from: types.number(),
  to: types.number(),
  format: types.string(),
});

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

/** @internal */
export const ThreeHundredAndNinetyFive$inboundSchema: z.ZodType<
  ThreeHundredAndNinetyFive,
  z.ZodTypeDef,
  unknown
> = z.object({
  tokenTypes: z.array(types.string()),
});

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

/** @internal */
export const ThreeHundredAndNinetyFour$inboundSchema: z.ZodType<
  ThreeHundredAndNinetyFour,
  z.ZodTypeDef,
  unknown
> = z.object({
  domain: types.string(),
  ips: z.array(types.string()),
});

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

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

/** @internal */
export const Previous1$inboundSchema: z.ZodType<
  Previous1,
  z.ZodTypeDef,
  unknown
> = z.object({
  accessGroupId: types.string(),
});

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

/** @internal */
export const UserEventPayload393Previous$inboundSchema: z.ZodType<
  UserEventPayload393Previous,
  z.ZodTypeDef,
  unknown
> = smartUnion([
  z.lazy(() => Previous1$inboundSchema),
  Previous2$inboundSchema,
]);

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

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

/** @internal */
export const Next1$inboundSchema: z.ZodType<Next1, z.ZodTypeDef, unknown> = z
  .object({
    accessGroupId: types.string(),
  });

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

/** @internal */
export const UserEventPayload393Next$inboundSchema: z.ZodType<
  UserEventPayload393Next,
  z.ZodTypeDef,
  unknown
> = smartUnion([z.lazy(() => Next1$inboundSchema), Next2$inboundSchema]);

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

/** @internal */
export const ThreeHundredAndNinetyThree$inboundSchema: z.ZodType<
  ThreeHundredAndNinetyThree,
  z.ZodTypeDef,
  unknown
> = z.object({
  previous: types.optional(
    z.record(smartUnion([
      z.lazy(() => Previous1$inboundSchema),
      Previous2$inboundSchema,
    ])),
  ),
  next: types.optional(
    z.record(
      smartUnion([z.lazy(() => Next1$inboundSchema), Next2$inboundSchema]),
    ),
  ),
});

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

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

/** @internal */
export const ThreeHundredAndNinetyTwo$inboundSchema: z.ZodType<
  ThreeHundredAndNinetyTwo,
  z.ZodTypeDef,
  unknown
> = z.object({
  enabled: types.boolean(),
  scope: PayloadScope$inboundSchema,
});

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

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

/** @internal */
export const ThreeHundredAndNinetyOne$inboundSchema: z.ZodType<
  ThreeHundredAndNinetyOne,
  z.ZodTypeDef,
  unknown
> = z.object({
  enabled: PayloadEnabled$inboundSchema,
});

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

/** @internal */
export const ThreeHundredAndNinety$inboundSchema: z.ZodType<
  ThreeHundredAndNinety,
  z.ZodTypeDef,
  unknown
> = z.object({
  deletedCount: types.number(),
});

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

/** @internal */
export const PayloadRemoteCaching$inboundSchema: z.ZodType<
  PayloadRemoteCaching,
  z.ZodTypeDef,
  unknown
> = z.object({
  enabled: types.optional(types.boolean()),
});

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

/** @internal */
export const ThreeHundredAndEightyNine$inboundSchema: z.ZodType<
  ThreeHundredAndEightyNine,
  z.ZodTypeDef,
  unknown
> = z.object({
  remoteCaching: types.optional(
    z.lazy(() => PayloadRemoteCaching$inboundSchema),
  ),
});

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

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

/** @internal */
export const ThreeHundredAndEightyEight$inboundSchema: z.ZodType<
  ThreeHundredAndEightyEight,
  z.ZodTypeDef,
  unknown
> = z.object({
  consent: PayloadConsent$inboundSchema,
});

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

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

/** @internal */
export const ThreeHundredAndEightySeven$inboundSchema: z.ZodType<
  ThreeHundredAndEightySeven,
  z.ZodTypeDef,
  unknown
> = z.object({
  decision: Decision$inboundSchema,
  version: types.string(),
});

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

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

/** @internal */
export const ThreeHundredAndEightySix$inboundSchema: z.ZodType<
  ThreeHundredAndEightySix,
  z.ZodTypeDef,
  unknown
> = z.object({
  name: types.optional(types.string()),
  actorId: types.string(),
  actorType: UserEventPayload386ActorType$inboundSchema,
  actorName: types.optional(types.string()),
});

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

/** @internal */
export const ThreeHundredAndEightyFive$inboundSchema: z.ZodType<
  ThreeHundredAndEightyFive,
  z.ZodTypeDef,
  unknown
> = z.object({
  name: types.optional(types.string()),
});

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

/** @internal */
export const ThreeHundredAndEightyFour$inboundSchema: z.ZodType<
  ThreeHundredAndEightyFour,
  z.ZodTypeDef,
  unknown
> = z.object({
  inviteCode: types.optional(types.string()),
});

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

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

/** @internal */
export const ThreeHundredAndEightyThree$inboundSchema: z.ZodType<
  ThreeHundredAndEightyThree,
  z.ZodTypeDef,
  unknown
> = z.object({
  invoiceId: types.string(),
  convertedFromTrial: types.boolean(),
  plan: PayloadPlan$inboundSchema,
});

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

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

/** @internal */
export const Trial$inboundSchema: z.ZodType<Trial, z.ZodTypeDef, unknown> = z
  .object({
    start: types.number(),
    end: types.number(),
  });

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

/** @internal */
export const ThreeHundredAndEightyTwo$inboundSchema: z.ZodType<
  ThreeHundredAndEightyTwo,
  z.ZodTypeDef,
  unknown
> = z.object({
  plan: UserEventPayloadPlan$inboundSchema,
  trial: z.nullable(z.lazy(() => Trial$inboundSchema)).optional(),
});

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

/** @internal */
export const ThreeHundredAndEightyOne$inboundSchema: z.ZodType<
  ThreeHundredAndEightyOne,
  z.ZodTypeDef,
  unknown
> = z.object({
  previousConcurrentBuilds: types.number(),
  nextConcurrentBuilds: types.number(),
});

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

/** @internal */
export const ThreeHundredAndEighty$inboundSchema: z.ZodType<
  ThreeHundredAndEighty,
  z.ZodTypeDef,
  unknown
> = z.object({
  publicId: types.string(),
  name: types.optional(types.string()),
});

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

/** @internal */
export const ThreeHundredAndSeventyNine$inboundSchema: z.ZodType<
  ThreeHundredAndSeventyNine,
  z.ZodTypeDef,
  unknown
> = z.object({
  publicId: types.string(),
  role: types.string(),
  maxUses: types.number(),
  expiresAt: types.string(),
  name: types.optional(types.string()),
});

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

/** @internal */
export const ThreeHundredAndSeventyEight$inboundSchema: z.ZodType<
  ThreeHundredAndSeventyEight,
  z.ZodTypeDef,
  unknown
> = z.object({
  enforced: types.boolean(),
});

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

/** @internal */
export const ThreeHundredAndSeventySeven$inboundSchema: z.ZodType<
  ThreeHundredAndSeventySeven,
  z.ZodTypeDef,
  unknown
> = z.object({
  email: types.optional(types.string()),
  authorized: types.boolean(),
  reason: types.optional(types.string()),
});

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

/** @internal */
export const PayloadUpdatedUser$inboundSchema: z.ZodType<
  PayloadUpdatedUser,
  z.ZodTypeDef,
  unknown
> = z.object({
  username: types.string(),
  email: types.string(),
});

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

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

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

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

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

/** @internal */
export const ThreeHundredAndSeventySix$inboundSchema: z.ZodType<
  ThreeHundredAndSeventySix,
  z.ZodTypeDef,
  unknown
> = z.object({
  directoryType: types.optional(types.string()),
  ssoType: types.optional(types.string()),
  updatedUser: types.optional(z.lazy(() => PayloadUpdatedUser$inboundSchema)),
  role: types.optional(types.string()),
  previousRole: types.string(),
  previousTeamRoles: types.optional(z.array(PreviousTeamRoles$inboundSchema)),
  teamRoles: types.optional(z.array(PayloadTeamRoles$inboundSchema)),
  previousTeamPermissions: types.optional(
    z.array(PreviousTeamPermissions$inboundSchema),
  ),
  teamPermissions: types.optional(
    z.array(PayloadTeamPermissions$inboundSchema),
  ),
  updatedUid: types.optional(types.string()),
  origin: types.optional(types.string()),
  teamSlug: types.optional(types.string()),
});

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

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

/** @internal */
export const ThreeHundredAndSeventyFive$inboundSchema: z.ZodType<
  ThreeHundredAndSeventyFive,
  z.ZodTypeDef,
  unknown
> = z.object({
  requestedTeamName: types.string(),
  requestedTeamSlug: types.optional(types.string()),
  requestedUserName: types.optional(types.string()),
  gitUsername: types.optional(types.string()),
  githubUsername: types.optional(types.string()),
  gitlabUsername: types.optional(types.string()),
  bitbucketUsername: types.optional(types.string()),
  source: types.optional(PayloadSource$inboundSchema),
});

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

/** @internal */
export const UpdatedUser$inboundSchema: z.ZodType<
  UpdatedUser,
  z.ZodTypeDef,
  unknown
> = z.object({
  username: types.string(),
  email: types.string(),
});

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

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

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

/** @internal */
export const ThreeHundredAndSeventyFour$inboundSchema: z.ZodType<
  ThreeHundredAndSeventyFour,
  z.ZodTypeDef,
  unknown
> = z.object({
  role: types.optional(types.string()),
  uid: types.optional(types.string()),
  updatedUid: types.optional(types.string()),
  updatedUser: types.optional(z.lazy(() => UpdatedUser$inboundSchema)),
  origin: types.optional(types.string()),
  teamSlug: types.optional(types.string()),
  teamRoles: types.optional(z.array(types.string())),
  teamPermissions: types.optional(z.array(types.string())),
  entitlements: types.optional(z.array(types.string())),
  invitedBy: types.optional(z.lazy(() => InvitedBy$inboundSchema)),
});

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

/** @internal */
export const UserEventPayload373User$inboundSchema: z.ZodType<
  UserEventPayload373User,
  z.ZodTypeDef,
  unknown
> = z.object({
  id: types.string(),
  username: types.string(),
});

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

/** @internal */
export const ThreeHundredAndSeventyThree$inboundSchema: z.ZodType<
  ThreeHundredAndSeventyThree,
  z.ZodTypeDef,
  unknown
> = z.object({
  entitlement: types.string(),
  user: z.lazy(() => UserEventPayload373User$inboundSchema),
  previousCanceledAt: types.optional(types.string()),
});

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

/** @internal */
export const UserEventPayloadUser$inboundSchema: z.ZodType<
  UserEventPayloadUser,
  z.ZodTypeDef,
  unknown
> = z.object({
  id: types.string(),
  username: types.string(),
});

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

/** @internal */
export const ThreeHundredAndSeventyTwo$inboundSchema: z.ZodType<
  ThreeHundredAndSeventyTwo,
  z.ZodTypeDef,
  unknown
> = z.object({
  entitlement: types.string(),
  user: z.lazy(() => UserEventPayloadUser$inboundSchema),
});

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

/** @internal */
export const PayloadDeletedUser$inboundSchema: z.ZodType<
  PayloadDeletedUser,
  z.ZodTypeDef,
  unknown
> = z.object({
  username: types.string(),
  email: types.string(),
});

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

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

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

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

/** @internal */
export const ThreeHundredAndSeventyOne$inboundSchema: z.ZodType<
  ThreeHundredAndSeventyOne,
  z.ZodTypeDef,
  unknown
> = z.object({
  deletedUser: types.optional(z.lazy(() => PayloadDeletedUser$inboundSchema)),
  deletedUid: types.optional(types.string()),
  githubUsername: z.nullable(types.string()).optional(),
  gitlabUsername: z.nullable(types.string()).optional(),
  bitbucketUsername: z.nullable(types.string()).optional(),
  directoryType: types.optional(types.string()),
  role: types.optional(PayloadRole$inboundSchema),
  reason: types.optional(types.string()),
  previousPlan: types.optional(PreviousPlan$inboundSchema),
  newPlan: types.optional(NewPlan$inboundSchema),
  automated: types.optional(types.boolean()),
});

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

/** @internal */
export const ThreeHundredAndSeventy$inboundSchema: z.ZodType<
  ThreeHundredAndSeventy,
  z.ZodTypeDef,
  unknown
> = z.object({
  teamName: types.string(),
  username: types.optional(types.string()),
  gitUsername: z.nullable(types.string()).optional(),
  githubUsername: z.nullable(types.string()).optional(),
  gitlabUsername: z.nullable(types.string()).optional(),
  bitbucketUsername: z.nullable(types.string()).optional(),
});

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

/** @internal */
export const ThreeHundredAndSixtyNine$inboundSchema: z.ZodType<
  ThreeHundredAndSixtyNine,
  z.ZodTypeDef,
  unknown
> = z.object({
  teamName: types.string(),
  username: types.optional(types.string()),
  gitUsername: types.optional(types.string()),
  githubUsername: z.nullable(types.string()).optional(),
  gitlabUsername: z.nullable(types.string()).optional(),
  bitbucketUsername: z.nullable(types.string()).optional(),
  updatedUid: types.optional(types.string()),
  teamId: types.optional(types.string()),
});

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

/** @internal */
export const InvitedUser$inboundSchema: z.ZodType<
  InvitedUser,
  z.ZodTypeDef,
  unknown
> = z.object({
  username: types.string(),
  email: types.string(),
});

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

/** @internal */
export const ThreeHundredAndSixtyEight$inboundSchema: z.ZodType<
  ThreeHundredAndSixtyEight,
  z.ZodTypeDef,
  unknown
> = z.object({
  directoryType: types.optional(types.string()),
  ssoType: types.optional(types.string()),
  invitedUser: types.optional(z.lazy(() => InvitedUser$inboundSchema)),
  invitedEmail: types.optional(types.string()),
  invitationRole: types.optional(types.string()),
  entitlements: types.optional(z.array(types.string())),
  invitedUid: types.optional(types.string()),
  origin: types.optional(types.string()),
  teamSlug: types.optional(types.string()),
});

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

/** @internal */
export const ThreeHundredAndSixtySeven$inboundSchema: z.ZodType<
  ThreeHundredAndSixtySeven,
  z.ZodTypeDef,
  unknown
> = z.object({
  deletedCount: types.number(),
  inviteIds: z.array(types.string()),
});

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

/** @internal */
export const ThreeHundredAndSixtySix$inboundSchema: z.ZodType<
  ThreeHundredAndSixtySix,
  z.ZodTypeDef,
  unknown
> = z.object({
  emailDomain: z.nullable(types.string()).optional(),
});

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

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

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

/** @internal */
export const ThreeHundredAndSixtyFive$inboundSchema: z.ZodType<
  ThreeHundredAndSixtyFive,
  z.ZodTypeDef,
  unknown
> = z.object({
  environment: UserEventPayloadEnvironment$inboundSchema,
  enabled: Enabled$inboundSchema,
});

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

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

/** @internal */
export const ThreeHundredAndSixtyFour$inboundSchema: z.ZodType<
  ThreeHundredAndSixtyFour,
  z.ZodTypeDef,
  unknown
> = z.object({
  projectId: types.string(),
  projectName: types.string(),
  enabled: types.nullable(types.boolean()),
  environment: PayloadEnvironment$inboundSchema,
});

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

/** @internal */
export const ThreeHundredAndSixtyThree$inboundSchema: z.ZodType<
  ThreeHundredAndSixtyThree,
  z.ZodTypeDef,
  unknown
> = z.object({
  enabled: types.boolean(),
  domain: types.optional(types.string()),
});

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

/** @internal */
export const UserEventPayload362Previous$inboundSchema: z.ZodType<
  UserEventPayload362Previous,
  z.ZodTypeDef,
  unknown
> = z.object({
  gitSources: z.nullable(z.array(z.any())).optional(),
  deploymentSources: z.nullable(z.array(z.any())).optional(),
});

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

/** @internal */
export const UserEventPayload362Next$inboundSchema: z.ZodType<
  UserEventPayload362Next,
  z.ZodTypeDef,
  unknown
> = z.object({
  gitSources: z.nullable(z.array(z.any())).optional(),
  deploymentSources: z.nullable(z.array(z.any())).optional(),
});

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

/** @internal */
export const ThreeHundredAndSixtyTwo$inboundSchema: z.ZodType<
  ThreeHundredAndSixtyTwo,
  z.ZodTypeDef,
  unknown
> = z.object({
  previous: types.nullable(
    z.lazy(() => UserEventPayload362Previous$inboundSchema),
  ),
  next: types.nullable(z.lazy(() => UserEventPayload362Next$inboundSchema)),
});

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

/** @internal */
export const Reasons$inboundSchema: z.ZodType<Reasons, z.ZodTypeDef, unknown> =
  z.object({
    slug: types.string(),
    description: types.string(),
  });

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

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

/** @internal */
export const UserEventPayloadRemovedUsers$inboundSchema: z.ZodType<
  UserEventPayloadRemovedUsers,
  z.ZodTypeDef,
  unknown
> = z.object({
  role: UserEventPayload361Role$inboundSchema,
  confirmed: types.boolean(),
  confirmedAt: types.optional(types.number()),
});

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

/** @internal */
export const ThreeHundredAndSixtyOne$inboundSchema: z.ZodType<
  ThreeHundredAndSixtyOne,
  z.ZodTypeDef,
  unknown
> = z.object({
  slug: types.string(),
  teamId: types.string(),
  by: types.string(),
  byUid: types.optional(types.string()),
  reasons: types.optional(z.array(z.lazy(() => Reasons$inboundSchema))),
  removedUsers: types.optional(
    z.record(z.lazy(() => UserEventPayloadRemovedUsers$inboundSchema)),
  ),
  removedMemberCount: types.optional(types.number()),
  timestamp: types.optional(types.number()),
});

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

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

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

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

/** @internal */
export const ThreeHundredAndSixty$inboundSchema: z.ZodType<
  ThreeHundredAndSixty,
  z.ZodTypeDef,
  unknown
> = z.object({
  previous: types.optional(UserEventPayload360Previous$inboundSchema),
  next: types.optional(UserEventPayload360Next$inboundSchema),
  isSystemInitiated: types.optional(types.boolean()),
  reason: types.optional(PayloadReason$inboundSchema),
});

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

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

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

/** @internal */
export const ThreeHundredAndFiftyNine$inboundSchema: z.ZodType<
  ThreeHundredAndFiftyNine,
  z.ZodTypeDef,
  unknown
> = z.object({
  previous: types.nullable(UserEventPayload359Previous$inboundSchema),
  next: types.nullable(UserEventPayload359Next$inboundSchema),
  teamSlug: types.optional(types.string()),
});

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

/** @internal */
export const ThreeHundredAndFiftyEight$inboundSchema: z.ZodType<
  ThreeHundredAndFiftyEight,
  z.ZodTypeDef,
  unknown
> = z.object({
  eventId: types.string(),
  sessionId: types.string(),
  sessionKind: types.string(),
  surface: types.string(),
  occurredAt: types.number(),
  planId: types.string(),
  requestedScopes: z.array(types.string()),
  elevatedScopes: z.array(types.string()),
  mergedScopes: z.array(types.string()),
  githubScopes: z.array(types.string()),
  requestedScopeCount: types.number(),
  elevatedScopeCount: types.number(),
  mergedScopeCount: types.number(),
  githubScopeCount: types.number(),
});

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

/** @internal */
export const ThreeHundredAndFiftySeven$inboundSchema: z.ZodType<
  ThreeHundredAndFiftySeven,
  z.ZodTypeDef,
  unknown
> = z.object({
  eventId: types.string(),
  sessionId: types.string(),
  sessionKind: types.string(),
  surface: types.string(),
  occurredAt: types.number(),
});

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

/** @internal */
export const ThreeHundredAndFiftySix$inboundSchema: z.ZodType<
  ThreeHundredAndFiftySix,
  z.ZodTypeDef,
  unknown
> = z.object({
  trialCreditsIssuedAt: types.number(),
  expiresAt: types.string(),
  amount: types.string(),
  currency: types.string(),
});

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

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

/** @internal */
export const UserEventPayload355Previous$inboundSchema: z.ZodType<
  UserEventPayload355Previous,
  z.ZodTypeDef,
  unknown
> = z.object({
  enabled: types.boolean(),
  scope: UserEventPayload355Scope$inboundSchema,
  includeDrafts: types.boolean(),
  selectedRepos: z.nullable(z.array(types.string())).optional(),
});

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

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

/** @internal */
export const UserEventPayload355Next$inboundSchema: z.ZodType<
  UserEventPayload355Next,
  z.ZodTypeDef,
  unknown
> = z.object({
  enabled: types.boolean(),
  scope: UserEventPayload355NextScope$inboundSchema,
  includeDrafts: types.boolean(),
  selectedRepos: z.nullable(z.array(types.string())).optional(),
});

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

/** @internal */
export const ThreeHundredAndFiftyFive$inboundSchema: z.ZodType<
  ThreeHundredAndFiftyFive,
  z.ZodTypeDef,
  unknown
> = z.object({
  previous: types.optional(
    z.lazy(() => UserEventPayload355Previous$inboundSchema),
  ),
  next: z.lazy(() => UserEventPayload355Next$inboundSchema),
});

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

/** @internal */
export const ThreeHundredAndFiftyFour$inboundSchema: z.ZodType<
  ThreeHundredAndFiftyFour,
  z.ZodTypeDef,
  unknown
> = z.object({
  slug: types.string(),
});

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

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

/** @internal */
export const ThreeHundredAndFiftyThree$inboundSchema: z.ZodType<
  ThreeHundredAndFiftyThree,
  z.ZodTypeDef,
  unknown
> = z.object({
  actorId: types.optional(types.string()),
  actorType: types.optional(UserEventPayload353ActorType$inboundSchema),
  reason: types.optional(types.string()),
  caseNumber: types.optional(types.string()),
  client: types.optional(types.string()),
});

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

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

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

/** @internal */
export const ThreeHundredAndFiftyTwo$inboundSchema: z.ZodType<
  ThreeHundredAndFiftyTwo,
  z.ZodTypeDef,
  unknown
> = z.object({
  id: types.string(),
  name: types.optional(types.string()),
  computeUnitsMax: types.optional(types.number()),
  computeUnitsMin: types.optional(types.number()),
  suspendTimeoutSeconds: types.optional(types.number()),
  type: UserEventPayload352Type$inboundSchema,
  access: types.optional(PayloadAccess$inboundSchema),
  locked: types.boolean(),
});

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

/** @internal */
export const UserEventPayload351Store$inboundSchema: z.ZodType<
  UserEventPayload351Store,
  z.ZodTypeDef,
  unknown
> = z.object({
  name: types.string(),
  id: types.string(),
});

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

/** @internal */
export const ThreeHundredAndFiftyOne$inboundSchema: z.ZodType<
  ThreeHundredAndFiftyOne,
  z.ZodTypeDef,
  unknown
> = z.object({
  store: z.lazy(() => UserEventPayload351Store$inboundSchema),
  ownerId: types.optional(types.string()),
});

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

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

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

/** @internal */
export const ThreeHundredAndFifty$inboundSchema: z.ZodType<
  ThreeHundredAndFifty,
  z.ZodTypeDef,
  unknown
> = z.object({
  id: types.string(),
  name: types.optional(types.string()),
  computeUnitsMax: types.optional(types.number()),
  computeUnitsMin: types.optional(types.number()),
  suspendTimeoutSeconds: types.optional(types.number()),
  type: UserEventPayload350Type$inboundSchema,
  access: types.optional(Access$inboundSchema),
});

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

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

/** @internal */
export const UserEventPayloadStore$inboundSchema: z.ZodType<
  UserEventPayloadStore,
  z.ZodTypeDef,
  unknown
> = z.object({
  id: types.string(),
  name: types.optional(types.string()),
  type: UserEventPayload349Type$inboundSchema,
});

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

/** @internal */
export const ThreeHundredAndFortyNine$inboundSchema: z.ZodType<
  ThreeHundredAndFortyNine,
  z.ZodTypeDef,
  unknown
> = z.object({
  transferRequestCode: types.string(),
  store: z.lazy(() => UserEventPayloadStore$inboundSchema),
  originTeamId: types.string(),
  originTeamName: types.string(),
});

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

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

/** @internal */
export const PayloadStore$inboundSchema: z.ZodType<
  PayloadStore,
  z.ZodTypeDef,
  unknown
> = z.object({
  id: types.string(),
  name: types.optional(types.string()),
  type: UserEventPayload348Type$inboundSchema,
});

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

/** @internal */
export const ThreeHundredAndFortyEight$inboundSchema: z.ZodType<
  ThreeHundredAndFortyEight,
  z.ZodTypeDef,
  unknown
> = z.object({
  transferRequestCode: types.string(),
  store: z.lazy(() => PayloadStore$inboundSchema),
  destinationTeamId: types.string(),
  destinationTeamName: types.string(),
});

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

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

/** @internal */
export const Store$inboundSchema: z.ZodType<Store, z.ZodTypeDef, unknown> = z
  .object({
    id: types.string(),
    name: types.optional(types.string()),
    type: UserEventPayload347Type$inboundSchema,
  });

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

/** @internal */
export const ThreeHundredAndFortySeven$inboundSchema: z.ZodType<
  ThreeHundredAndFortySeven,
  z.ZodTypeDef,
  unknown
> = z.object({
  transferRequestCode: types.string(),
  store: z.lazy(() => Store$inboundSchema),
});

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

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

/** @internal */
export const ThreeHundredAndFortySix$inboundSchema: z.ZodType<
  ThreeHundredAndFortySix,
  z.ZodTypeDef,
  unknown
> = z.object({
  storeType: StoreType$inboundSchema,
});

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

/** @internal */
export const ThreeHundredAndFortyFive$inboundSchema: z.ZodType<
  ThreeHundredAndFortyFive,
  z.ZodTypeDef,
  unknown
> = z.object({
  webhookUrl: types.optional(types.string()),
});

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

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

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

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

/** @internal */
export const UserEventPayload344Budget$inboundSchema: z.ZodType<
  UserEventPayload344Budget,
  z.ZodTypeDef,
  unknown
> = z.object({
  type: UserEventPayload344Type$inboundSchema,
  fixedBudget: types.number(),
  previousSpend: z.array(types.number()),
  notifiedAt: z.array(types.number()),
  webhookId: types.optional(types.string()),
  webhookNotified: types.optional(types.boolean()),
  createdAt: types.number(),
  updatedAt: types.optional(types.number()),
  isActive: types.boolean(),
  pauseProjects: types.optional(types.boolean()),
  pricingPlan: types.optional(UserEventPayloadPricingPlan$inboundSchema),
  scope: types.optional(UserEventPayload344Scope$inboundSchema),
  scopeId: types.optional(types.string()),
  teamId: types.string(),
  id: types.string(),
});

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

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

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

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

/** @internal */
export const PrevBudget$inboundSchema: z.ZodType<
  PrevBudget,
  z.ZodTypeDef,
  unknown
> = z.object({
  type: UserEventPayload344PrevBudgetType$inboundSchema,
  fixedBudget: types.number(),
  previousSpend: z.array(types.number()),
  notifiedAt: z.array(types.number()),
  webhookId: types.optional(types.string()),
  webhookNotified: types.optional(types.boolean()),
  createdAt: types.number(),
  updatedAt: types.optional(types.number()),
  isActive: types.boolean(),
  pauseProjects: types.optional(types.boolean()),
  pricingPlan: types.optional(UserEventPayload344PricingPlan$inboundSchema),
  scope: types.optional(UserEventPayload344PrevBudgetScope$inboundSchema),
  scopeId: types.optional(types.string()),
  teamId: types.string(),
  id: types.string(),
});

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

/** @internal */
export const ThreeHundredAndFortyFour$inboundSchema: z.ZodType<
  ThreeHundredAndFortyFour,
  z.ZodTypeDef,
  unknown
> = z.object({
  budget: z.lazy(() => UserEventPayload344Budget$inboundSchema),
  prevBudget: types.optional(z.lazy(() => PrevBudget$inboundSchema)),
  webhookUrl: types.optional(types.string()),
  prevWebhookUrl: types.optional(types.string()),
});

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

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

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

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

/** @internal */
export const UserEventPayload343Budget$inboundSchema: z.ZodType<
  UserEventPayload343Budget,
  z.ZodTypeDef,
  unknown
> = z.object({
  type: UserEventPayload343Type$inboundSchema,
  fixedBudget: types.number(),
  previousSpend: z.array(types.number()),
  notifiedAt: z.array(types.number()),
  webhookId: types.optional(types.string()),
  webhookNotified: types.optional(types.boolean()),
  createdAt: types.number(),
  updatedAt: types.optional(types.number()),
  isActive: types.boolean(),
  pauseProjects: types.optional(types.boolean()),
  pricingPlan: types.optional(PayloadPricingPlan$inboundSchema),
  scope: types.optional(UserEventPayload343Scope$inboundSchema),
  scopeId: types.optional(types.string()),
  teamId: types.string(),
  id: types.string(),
});

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

/** @internal */
export const ThreeHundredAndFortyThree$inboundSchema: z.ZodType<
  ThreeHundredAndFortyThree,
  z.ZodTypeDef,
  unknown
> = z.object({
  budget: z.lazy(() => UserEventPayload343Budget$inboundSchema),
  webhookUrl: types.optional(types.string()),
});

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

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

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

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

/** @internal */
export const UserEventPayload342Budget$inboundSchema: z.ZodType<
  UserEventPayload342Budget,
  z.ZodTypeDef,
  unknown
> = z.object({
  type: UserEventPayload342Type$inboundSchema,
  fixedBudget: types.number(),
  previousSpend: z.array(types.number()),
  notifiedAt: z.array(types.number()),
  webhookId: types.optional(types.string()),
  webhookNotified: types.optional(types.boolean()),
  createdAt: types.number(),
  updatedAt: types.optional(types.number()),
  isActive: types.boolean(),
  pauseProjects: types.optional(types.boolean()),
  pricingPlan: types.optional(PricingPlan$inboundSchema),
  scope: types.optional(UserEventPayload342Scope$inboundSchema),
  scopeId: types.optional(types.string()),
  teamId: types.string(),
  id: types.string(),
});

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

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

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