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

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

/**
 * Forces a new deployment even if there is a previous similar deployment
 */
export const ForceNew = {
  Zero: "0",
  One: "1",
} as const;
/**
 * Forces a new deployment even if there is a previous similar deployment
 */
export type ForceNew = ClosedEnum<typeof ForceNew>;

/**
 * Allows to skip framework detection so the API would not fail to ask for confirmation
 */
export const SkipAutoDetectionConfirmation = {
  Zero: "0",
  One: "1",
} as const;
/**
 * Allows to skip framework detection so the API would not fail to ask for confirmation
 */
export type SkipAutoDetectionConfirmation = ClosedEnum<
  typeof SkipAutoDetectionConfirmation
>;

/**
 * Used in the case you want to reference a file that was already uploaded
 */
export type UploadedFile = {
  /**
   * The file path relative to the project root
   */
  file: string;
  /**
   * The file contents hashed with SHA1, used to check the integrity
   */
  sha?: string | undefined;
  /**
   * The file size in bytes
   */
  size?: number | undefined;
};

/**
 * The file content encoding, it could be either a base64 (useful for images, etc.) of the files or the plain text for source code.
 */
export const Encoding = {
  Base64: "base64",
  Utf8: "utf-8",
} as const;
/**
 * The file content encoding, it could be either a base64 (useful for images, etc.) of the files or the plain text for source code.
 */
export type Encoding = ClosedEnum<typeof Encoding>;

/**
 * Used in the case you want to inline a file inside the request
 */
export type InlinedFile = {
  /**
   * The file content, it could be either a `base64` (useful for images, etc.) of the files or the plain content for source code
   */
  data: string;
  /**
   * The file content encoding, it could be either a base64 (useful for images, etc.) of the files or the plain text for source code.
   */
  encoding?: Encoding | undefined;
  /**
   * The file name including the whole path
   */
  file: string;
};

export type Files = InlinedFile | UploadedFile;

/**
 * Populates initial git metadata for different git providers.
 */
export type GitMetadata = {
  /**
   * The git repository's remote origin url
   */
  remoteUrl?: string | undefined;
  /**
   * The name of the author of the commit
   */
  commitAuthorName?: string | undefined;
  /**
   * The email of the author of the commit
   */
  commitAuthorEmail?: string | undefined;
  /**
   * The commit message
   */
  commitMessage?: string | undefined;
  /**
   * The branch on which the commit was made
   */
  commitRef?: string | undefined;
  /**
   * The hash of the commit
   */
  commitSha?: string | undefined;
  /**
   * Whether or not there have been modifications to the working tree since the latest commit
   */
  dirty?: boolean | undefined;
  /**
   * True if process.env.CI was set when deploying
   */
  ci?: boolean | undefined;
  /**
   * The type of CI system used
   */
  ciType?: string | undefined;
  /**
   * The username used for the Git Provider (e.g. GitHub) if their CI (e.g. GitHub Actions) was used, if available
   */
  ciGitProviderUsername?: string | undefined;
  /**
   * The visibility of the Git repository if their CI (e.g. GitHub Actions) was used, if available
   */
  ciGitRepoVisibility?: string | undefined;
};

export const CreateDeploymentGitSourceDeploymentsRequestRequestBody8Type = {
  Bitbucket: "bitbucket",
} as const;
export type CreateDeploymentGitSourceDeploymentsRequestRequestBody8Type =
  ClosedEnum<
    typeof CreateDeploymentGitSourceDeploymentsRequestRequestBody8Type
  >;

export type GitSource8 = {
  owner: string;
  ref: string;
  sha?: string | undefined;
  slug: string;
  type: CreateDeploymentGitSourceDeploymentsRequestRequestBody8Type;
};

export const CreateDeploymentGitSourceDeploymentsRequestRequestBody7Type = {
  Bitbucket: "bitbucket",
} as const;
export type CreateDeploymentGitSourceDeploymentsRequestRequestBody7Type =
  ClosedEnum<
    typeof CreateDeploymentGitSourceDeploymentsRequestRequestBody7Type
  >;

export type GitSource7 = {
  ref: string;
  repoUuid: string;
  sha?: string | undefined;
  type: CreateDeploymentGitSourceDeploymentsRequestRequestBody7Type;
  workspaceUuid?: string | undefined;
};

export type ProjectId = number | string;

export const CreateDeploymentGitSourceDeploymentsRequestRequestBody6Type = {
  Gitlab: "gitlab",
} as const;
export type CreateDeploymentGitSourceDeploymentsRequestRequestBody6Type =
  ClosedEnum<
    typeof CreateDeploymentGitSourceDeploymentsRequestRequestBody6Type
  >;

export type GitSource6 = {
  projectId: number | string;
  ref: string;
  sha?: string | undefined;
  type: CreateDeploymentGitSourceDeploymentsRequestRequestBody6Type;
};

export const CreateDeploymentGitSourceDeploymentsRequestRequestBodyType = {
  GithubLimited: "github-limited",
} as const;
export type CreateDeploymentGitSourceDeploymentsRequestRequestBodyType =
  ClosedEnum<typeof CreateDeploymentGitSourceDeploymentsRequestRequestBodyType>;

export type GitSource5 = {
  org: string;
  ref: string;
  repo: string;
  sha?: string | undefined;
  type: CreateDeploymentGitSourceDeploymentsRequestRequestBodyType;
};

export type GitSourceRepoId = number | string;

export const CreateDeploymentGitSourceDeploymentsRequestType = {
  GithubLimited: "github-limited",
} as const;
export type CreateDeploymentGitSourceDeploymentsRequestType = ClosedEnum<
  typeof CreateDeploymentGitSourceDeploymentsRequestType
>;

export type GitSource4 = {
  ref: string;
  repoId: number | string;
  sha?: string | undefined;
  type: CreateDeploymentGitSourceDeploymentsRequestType;
};

export const CreateDeploymentGitSourceDeploymentsType = {
  Github: "github",
} as const;
export type CreateDeploymentGitSourceDeploymentsType = ClosedEnum<
  typeof CreateDeploymentGitSourceDeploymentsType
>;

export type GitSource3 = {
  org: string;
  ref: string;
  repo: string;
  sha?: string | undefined;
  type: CreateDeploymentGitSourceDeploymentsType;
};

export type RepoId = number | string;

export const CreateDeploymentGitSourceType = {
  Github: "github",
} as const;
export type CreateDeploymentGitSourceType = ClosedEnum<
  typeof CreateDeploymentGitSourceType
>;

export type GitSource2 = {
  ref: string;
  repoId: number | string;
  sha?: string | undefined;
  type: CreateDeploymentGitSourceType;
};

export const GitSourceType = {
  Vercel: "vercel",
} as const;
export type GitSourceType = ClosedEnum<typeof GitSourceType>;

export type GitSource1 = {
  type: GitSourceType;
  sha: string;
};

/**
 * Defines the Git Repository source to be deployed. This property can not be used in combination with `files`.
 */
export type GitSource =
  | GitSource3
  | GitSource5
  | GitSource8
  | GitSource2
  | GitSource4
  | GitSource6
  | GitSource7
  | GitSource1;

/**
 * The framework that is being used for this project. When `null` is used no framework is selected
 */
export const Framework = {
  Blitzjs: "blitzjs",
  Nextjs: "nextjs",
  Gatsby: "gatsby",
  Remix: "remix",
  ReactRouter: "react-router",
  Astro: "astro",
  Hexo: "hexo",
  Eleventy: "eleventy",
  Docusaurus2: "docusaurus-2",
  Docusaurus: "docusaurus",
  Preact: "preact",
  Solidstart1: "solidstart-1",
  Solidstart: "solidstart",
  Dojo: "dojo",
  Ember: "ember",
  Vue: "vue",
  Scully: "scully",
  IonicAngular: "ionic-angular",
  Angular: "angular",
  Polymer: "polymer",
  Svelte: "svelte",
  Sveltekit: "sveltekit",
  Sveltekit1: "sveltekit-1",
  IonicReact: "ionic-react",
  CreateReactApp: "create-react-app",
  Gridsome: "gridsome",
  Umijs: "umijs",
  Sapper: "sapper",
  Saber: "saber",
  Stencil: "stencil",
  Nuxtjs: "nuxtjs",
  Redwoodjs: "redwoodjs",
  Hugo: "hugo",
  Jekyll: "jekyll",
  Brunch: "brunch",
  Middleman: "middleman",
  Zola: "zola",
  Hydrogen: "hydrogen",
  Vite: "vite",
  TanstackStart: "tanstack-start",
  Vitepress: "vitepress",
  Vuepress: "vuepress",
  Parcel: "parcel",
  Fastapi: "fastapi",
  Flask: "flask",
  Fasthtml: "fasthtml",
  Django: "django",
  Ash: "ash",
  Eve: "eve",
  Sanity: "sanity",
  SanityV2: "sanity-v2",
  Storybook: "storybook",
  Nitro: "nitro",
  Hono: "hono",
  Express: "express",
  H3: "h3",
  Koa: "koa",
  Nestjs: "nestjs",
  Elysia: "elysia",
  Fastify: "fastify",
  Xmcp: "xmcp",
  Python: "python",
  Ruby: "ruby",
  Rust: "rust",
  Axum: "axum",
  ActixWeb: "actix-web",
  Bun: "bun",
  Node: "node",
  Go: "go",
  Services: "services",
  Mastra: "mastra",
} as const;
/**
 * The framework that is being used for this project. When `null` is used no framework is selected
 */
export type Framework = ClosedEnum<typeof Framework>;

/**
 * Override the Node.js version that should be used for this deployment
 */
export const NodeVersion = {
  TwentyFourDotX: "24.x",
  TwentyTwoDotX: "22.x",
  TwentyDotX: "20.x",
  EighteenDotX: "18.x",
  SixteenDotX: "16.x",
  FourteenDotX: "14.x",
  TwelveDotX: "12.x",
  TenDotX: "10.x",
  EightDot10DotX: "8.10.x",
} as const;
/**
 * Override the Node.js version that should be used for this deployment
 */
export type NodeVersion = ClosedEnum<typeof NodeVersion>;

/**
 * Project settings that will be applied to the deployment. It is required for the first deployment of a project and will be saved for any following deployments
 */
export type ProjectSettings = {
  /**
   * The build command for this project. When `null` is used this value will be automatically detected
   */
  buildCommand?: string | null | undefined;
  commandForIgnoringBuildStep?: string | null | undefined;
  /**
   * The dev command for this project. When `null` is used this value will be automatically detected
   */
  devCommand?: string | null | undefined;
  /**
   * The framework that is being used for this project. When `null` is used no framework is selected
   */
  framework?: Framework | null | undefined;
  /**
   * The install command for this project. When `null` is used this value will be automatically detected
   */
  installCommand?: string | null | undefined;
  /**
   * Override the Node.js version that should be used for this deployment
   */
  nodeVersion?: NodeVersion | undefined;
  /**
   * The output directory of the project. When `null` is used this value will be automatically detected
   */
  outputDirectory?: string | null | undefined;
  /**
   * The name of a directory or relative path to the source code of your project. When `null` is used it will default to the project root
   */
  rootDirectory?: string | null | undefined;
  /**
   * The region to deploy Serverless Functions in this project
   */
  serverlessFunctionRegion?: string | null | undefined;
  /**
   * Opts-out of the message prompting a CLI user to connect a Git repository in `vercel link`.
   *
   * @deprecated field: This will be removed in a future release, please migrate away from it as soon as possible.
   */
  skipGitConnectDuringLink?: boolean | undefined;
  /**
   * Indicates if there are source files outside of the root directory, typically used for monorepos
   */
  sourceFilesOutsideRootDirectory?: boolean | undefined;
};

export type CreateDeploymentRequestBody = {
  /**
   * Deploy to a custom environment, which will override the default environment
   */
  customEnvironmentSlugOrId?: string | undefined;
  /**
   * An deployment id for an existing deployment to redeploy
   */
  deploymentId?: string | undefined;
  /**
   * A list of objects with the files to be deployed
   */
  files?: Array<InlinedFile | UploadedFile> | undefined;
  /**
   * Populates initial git metadata for different git providers.
   */
  gitMetadata?: GitMetadata | undefined;
  /**
   * Defines the Git Repository source to be deployed. This property can not be used in combination with `files`.
   */
  gitSource?:
    | GitSource3
    | GitSource5
    | GitSource8
    | GitSource2
    | GitSource4
    | GitSource6
    | GitSource7
    | GitSource1
    | undefined;
  /**
   * An object containing the deployment's metadata. Multiple key-value pairs can be attached to a deployment
   */
  meta?: { [k: string]: string } | undefined;
  /**
   * The monorepo manager that is being used for this deployment. When `null` is used no monorepo manager is selected
   */
  monorepoManager?: string | null | undefined;
  /**
   * A string with the project name used in the deployment URL
   */
  name: string;
  /**
   * The target project identifier in which the deployment will be created. When defined, this parameter overrides name
   */
  project?: string | undefined;
  /**
   * Project settings that will be applied to the deployment. It is required for the first deployment of a project and will be saved for any following deployments
   */
  projectSettings?: ProjectSettings | undefined;
  /**
   * Either not defined, `staging`, `production`, or a custom environment identifier. If `staging`, a staging alias in the format `<project>-<team>.vercel.app` will be assigned. If `production`, any aliases defined in `alias` will be assigned. If omitted, the target will be `preview`.
   */
  target?: string | undefined;
  /**
   * When `true` and `deploymentId` is passed in, the sha from the previous deployment's `gitSource` is removed forcing the latest commit to be used.
   */
  withLatestCommit?: boolean | undefined;
};

export type CreateDeploymentRequest = {
  /**
   * Forces a new deployment even if there is a previous similar deployment
   */
  forceNew?: ForceNew | undefined;
  /**
   * Allows to skip framework detection so the API would not fail to ask for confirmation
   */
  skipAutoDetectionConfirmation?: SkipAutoDetectionConfirmation | undefined;
  /**
   * The Team identifier to perform the request on behalf of.
   */
  teamId?: string | undefined;
  /**
   * The Team slug to perform the request on behalf of.
   */
  slug?: string | undefined;
  requestBody: CreateDeploymentRequestBody;
};

export type AliasAssignedAt = number | boolean;

export type Build = {
  env: Array<string>;
};

export type Builds = {
  use: string;
  src?: string | undefined;
  config?: { [k: string]: any } | undefined;
};

export const CreateDeploymentDeploymentsNodeVersion = {
  TenDotX: "10.x",
  TwelveDotX: "12.x",
  FourteenDotX: "14.x",
  SixteenDotX: "16.x",
  EighteenDotX: "18.x",
  TwentyDotX: "20.x",
  TwentyTwoDotX: "22.x",
  TwentyFourDotX: "24.x",
  EightDot10DotX: "8.10.x",
} as const;
export type CreateDeploymentDeploymentsNodeVersion = ClosedEnum<
  typeof CreateDeploymentDeploymentsNodeVersion
>;

export const CreateDeploymentFramework = {
  ActixWeb: "actix-web",
  Angular: "angular",
  Ash: "ash",
  Astro: "astro",
  Axum: "axum",
  Blitzjs: "blitzjs",
  Brunch: "brunch",
  Bun: "bun",
  CreateReactApp: "create-react-app",
  Django: "django",
  Docusaurus: "docusaurus",
  Docusaurus2: "docusaurus-2",
  Dojo: "dojo",
  Eleventy: "eleventy",
  Elysia: "elysia",
  Ember: "ember",
  Eve: "eve",
  Express: "express",
  Fastapi: "fastapi",
  Fasthtml: "fasthtml",
  Fastify: "fastify",
  Flask: "flask",
  Gatsby: "gatsby",
  Go: "go",
  Gridsome: "gridsome",
  H3: "h3",
  Hexo: "hexo",
  Hono: "hono",
  Hugo: "hugo",
  Hydrogen: "hydrogen",
  IonicAngular: "ionic-angular",
  IonicReact: "ionic-react",
  Jekyll: "jekyll",
  Koa: "koa",
  Mastra: "mastra",
  Middleman: "middleman",
  Nestjs: "nestjs",
  Nextjs: "nextjs",
  Nitro: "nitro",
  Node: "node",
  Nuxtjs: "nuxtjs",
  Parcel: "parcel",
  Polymer: "polymer",
  Preact: "preact",
  Python: "python",
  ReactRouter: "react-router",
  Redwoodjs: "redwoodjs",
  Remix: "remix",
  Ruby: "ruby",
  Rust: "rust",
  Saber: "saber",
  Sanity: "sanity",
  SanityV2: "sanity-v2",
  Sapper: "sapper",
  Scully: "scully",
  Services: "services",
  Solidstart: "solidstart",
  Solidstart1: "solidstart-1",
  Stencil: "stencil",
  Storybook: "storybook",
  Svelte: "svelte",
  Sveltekit: "sveltekit",
  Sveltekit1: "sveltekit-1",
  TanstackStart: "tanstack-start",
  Umijs: "umijs",
  Vite: "vite",
  Vitepress: "vitepress",
  Vue: "vue",
  Vuepress: "vuepress",
  Xmcp: "xmcp",
  Zola: "zola",
} as const;
export type CreateDeploymentFramework = ClosedEnum<
  typeof CreateDeploymentFramework
>;

export type CreateDeploymentSpeedInsights = {
  id: string;
  enabledAt?: number | undefined;
  disabledAt?: number | undefined;
  canceledAt?: number | undefined;
  hasData?: boolean | undefined;
  paidAt?: number | undefined;
};

export type CreateDeploymentWebAnalytics = {
  id: string;
  disabledAt?: number | undefined;
  canceledAt?: number | undefined;
  enabledAt?: number | undefined;
  hasData?: true | undefined;
};

export type CreateDeploymentProjectSettings = {
  nodeVersion?: CreateDeploymentDeploymentsNodeVersion | undefined;
  buildCommand?: string | null | undefined;
  devCommand?: string | null | undefined;
  framework?: CreateDeploymentFramework | null | undefined;
  commandForIgnoringBuildStep?: string | null | undefined;
  installCommand?: string | null | undefined;
  outputDirectory?: string | null | undefined;
  speedInsights?: CreateDeploymentSpeedInsights | undefined;
  webAnalytics?: CreateDeploymentWebAnalytics | undefined;
};

export const CreateDeploymentDeploymentsStatus = {
  Error: "error",
  Pending: "pending",
  Ready: "ready",
  Skipped: "skipped",
  Timeout: "timeout",
} as const;
export type CreateDeploymentDeploymentsStatus = ClosedEnum<
  typeof CreateDeploymentDeploymentsStatus
>;

export type Integrations = {
  status: CreateDeploymentDeploymentsStatus;
  startedAt: number;
  claimedAt?: number | undefined;
  completedAt?: number | undefined;
  skippedAt?: number | undefined;
  skippedBy?: string | undefined;
};

/**
 * Must be `http` or `https`.
 */
export const Protocol = {
  Http: "http",
  Https: "https",
} as const;
/**
 * Must be `http` or `https`.
 */
export type Protocol = ClosedEnum<typeof Protocol>;

export type RemotePatterns = {
  /**
   * Must be `http` or `https`.
   */
  protocol?: Protocol | undefined;
  /**
   * Can be literal or wildcard. Single `*` matches a single subdomain. Double `**` matches any number of subdomains.
   */
  hostname: string;
  /**
   * Can be literal port such as `8080` or empty string meaning no port.
   */
  port?: string | undefined;
  /**
   * Can be literal or wildcard. Single `*` matches a single path segment. Double `**` matches any number of path segments.
   */
  pathname?: string | undefined;
  /**
   * Can be literal query string such as `?v=1` or empty string meaning no query string.
   */
  search?: string | undefined;
};

export type LocalPatterns = {
  /**
   * Can be literal or wildcard. Single `*` matches a single path segment. Double `**` matches any number of path segments.
   */
  pathname?: string | undefined;
  /**
   * Can be literal query string such as `?v=1` or empty string meaning no query string.
   */
  search?: string | undefined;
};

export const Formats = {
  ImageAvif: "image/avif",
  ImageWebp: "image/webp",
} as const;
export type Formats = ClosedEnum<typeof Formats>;

export const ContentDispositionType = {
  Attachment: "attachment",
  Inline: "inline",
} as const;
export type ContentDispositionType = ClosedEnum<typeof ContentDispositionType>;

export type Images = {
  sizes?: Array<number> | undefined;
  qualities?: Array<number> | undefined;
  domains?: Array<string> | undefined;
  remotePatterns?: Array<RemotePatterns> | undefined;
  localPatterns?: Array<LocalPatterns> | undefined;
  minimumCacheTTL?: number | undefined;
  formats?: Array<Formats> | undefined;
  dangerouslyAllowSVG?: boolean | undefined;
  contentSecurityPolicy?: string | undefined;
  contentDispositionType?: ContentDispositionType | undefined;
};

/**
 * Information about the deployment creator
 */
export type CreateDeploymentCreator = {
  /**
   * The ID of the user that created the deployment
   */
  uid: string;
  /**
   * The username of the user that created the deployment
   */
  username?: string | undefined;
  /**
   * The avatar of the user that created the deployment
   */
  avatar?: string | undefined;
};

export const CreateDeploymentReadyState = {
  Building: "BUILDING",
  Error: "ERROR",
  Initializing: "INITIALIZING",
  Ready: "READY",
} as const;
export type CreateDeploymentReadyState = ClosedEnum<
  typeof CreateDeploymentReadyState
>;

export type CreateDeploymentOutput = {
  path: string;
  functionName: string;
};

/**
 * A partial representation of a Build used by the deployment endpoint.
 */
export type Lambdas = {
  id: string;
  createdAt?: number | undefined;
  readyState?: CreateDeploymentReadyState | undefined;
  entrypoint?: string | null | undefined;
  readyStateAt?: number | undefined;
  output: Array<CreateDeploymentOutput>;
};

export const CreateDeploymentStatus = {
  Blocked: "BLOCKED",
  Building: "BUILDING",
  Canceled: "CANCELED",
  Error: "ERROR",
  Initializing: "INITIALIZING",
  Queued: "QUEUED",
  Ready: "READY",
} as const;
export type CreateDeploymentStatus = ClosedEnum<typeof CreateDeploymentStatus>;

/**
 * The team that owns the deployment if any
 */
export type CreateDeploymentTeam = {
  id: string;
  name: string;
  slug: string;
  avatar?: string | undefined;
};

/**
 * If the deployment was created using a Custom Environment, then this property contains information regarding the environment used.
 */
export type CustomEnvironment2 = {
  id: string;
};

/**
 * The type of environment (production, preview, or development)
 */
export const CustomEnvironmentType = {
  Development: "development",
  Preview: "preview",
  Production: "production",
} as const;
/**
 * The type of environment (production, preview, or development)
 */
export type CustomEnvironmentType = ClosedEnum<typeof CustomEnvironmentType>;

/**
 * The type of matching to perform
 */
export const CreateDeploymentCustomEnvironmentType = {
  EndsWith: "endsWith",
  Equals: "equals",
  StartsWith: "startsWith",
} as const;
/**
 * The type of matching to perform
 */
export type CreateDeploymentCustomEnvironmentType = ClosedEnum<
  typeof CreateDeploymentCustomEnvironmentType
>;

/**
 * Configuration for matching git branches to this environment
 */
export type CreateDeploymentCustomEnvironmentBranchMatcher = {
  /**
   * The type of matching to perform
   */
  type: CreateDeploymentCustomEnvironmentType;
  /**
   * The pattern to match against branch names
   */
  pattern: string;
};

/**
 * A list of verification challenges, one of which must be completed to verify the domain for use on the project. After the challenge is complete `POST /projects/:idOrName/domains/:domain/verify` to verify the domain. Possible challenges: - If `verification.type = TXT` the `verification.domain` will be checked for a TXT record matching `verification.value`.
 */
export type CreateDeploymentCustomEnvironmentVerification = {
  type: string;
  domain: string;
  value: string;
  reason: string;
};

/**
 * List of domains associated with this environment
 */
export type CreateDeploymentCustomEnvironmentDomains = {
  name: string;
  apexName: string;
  projectId: string;
  redirect?: string | null | undefined;
  redirectStatusCode?: number | null | undefined;
  gitBranch?: string | null | undefined;
  customEnvironmentId?: string | null | undefined;
  updatedAt?: number | undefined;
  createdAt?: number | undefined;
  /**
   * `true` if the domain is verified for use with the project. If `false` it will not be used as an alias on this project until the challenge in `verification` is completed.
   */
  verified: boolean;
  /**
   * A list of verification challenges, one of which must be completed to verify the domain for use on the project. After the challenge is complete `POST /projects/:idOrName/domains/:domain/verify` to verify the domain. Possible challenges: - If `verification.type = TXT` the `verification.domain` will be checked for a TXT record matching `verification.value`.
   */
  verification?:
    | Array<CreateDeploymentCustomEnvironmentVerification>
    | undefined;
};

/**
 * If the deployment was created using a Custom Environment, then this property contains information regarding the environment used.
 */
export type CustomEnvironment1 = {
  /**
   * Unique identifier for the custom environment (format: env_*)
   */
  id: string;
  /**
   * URL-friendly name of the environment
   */
  slug: string;
  /**
   * The type of environment (production, preview, or development)
   */
  type: CustomEnvironmentType;
  /**
   * Optional description of the environment's purpose
   */
  description?: string | undefined;
  /**
   * Configuration for matching git branches to this environment
   */
  branchMatcher?: CreateDeploymentCustomEnvironmentBranchMatcher | undefined;
  /**
   * List of domains associated with this environment
   */
  domains?: Array<CreateDeploymentCustomEnvironmentDomains> | undefined;
  /**
   * List of aliases for the current deployment
   */
  currentDeploymentAliases?: Array<string> | undefined;
  /**
   * Timestamp when the environment was created
   */
  createdAt: number;
  /**
   * Timestamp when the environment was last updated
   */
  updatedAt: number;
};

export type CustomEnvironment = CustomEnvironment1 | CustomEnvironment2;

export const OomReport = {
  OutOfMemory: "out-of-memory",
} as const;
export type OomReport = ClosedEnum<typeof OomReport>;

export type AliasWarning = {
  code: string;
  message: string;
  link?: string | undefined;
  action?: string | undefined;
};

/**
 * The state of the deployment depending on the process of deploying, or if it is ready or in an error state
 */
export const ReadyState = {
  Blocked: "BLOCKED",
  Building: "BUILDING",
  Canceled: "CANCELED",
  Error: "ERROR",
  Initializing: "INITIALIZING",
  Queued: "QUEUED",
  Ready: "READY",
} as const;
/**
 * The state of the deployment depending on the process of deploying, or if it is ready or in an error state
 */
export type ReadyState = ClosedEnum<typeof ReadyState>;

export const CreateDeploymentType = {
  Lambdas: "LAMBDAS",
} as const;
export type CreateDeploymentType = ClosedEnum<typeof CreateDeploymentType>;

/**
 * An object that will contain a `code` and a `message` when the aliasing fails, otherwise the value will be `null`
 */
export type AliasError = {
  code: string;
  message: string;
};

export const ChecksState = {
  Completed: "completed",
  Registered: "registered",
  Running: "running",
} as const;
export type ChecksState = ClosedEnum<typeof ChecksState>;

export const ChecksConclusion = {
  Canceled: "canceled",
  Failed: "failed",
  Skipped: "skipped",
  Succeeded: "succeeded",
} as const;
export type ChecksConclusion = ClosedEnum<typeof ChecksConclusion>;

export const CreateDeploymentGitSourceDeploymentsResponse200ApplicationJSONResponseBody17Type =
  {
    Vercel: "vercel",
  } as const;
export type CreateDeploymentGitSourceDeploymentsResponse200ApplicationJSONResponseBody17Type =
  ClosedEnum<
    typeof CreateDeploymentGitSourceDeploymentsResponse200ApplicationJSONResponseBody17Type
  >;

export type CreateDeploymentGitSource17 = {
  type:
    CreateDeploymentGitSourceDeploymentsResponse200ApplicationJSONResponseBody17Type;
  ref: string;
  sha: string;
  org: string;
  repo: string;
  repoPushedAt?: number | undefined;
};

export const CreateDeploymentGitSourceDeploymentsResponse200ApplicationJSONResponseBody16Type =
  {
    Bitbucket: "bitbucket",
  } as const;
export type CreateDeploymentGitSourceDeploymentsResponse200ApplicationJSONResponseBody16Type =
  ClosedEnum<
    typeof CreateDeploymentGitSourceDeploymentsResponse200ApplicationJSONResponseBody16Type
  >;

export type CreateDeploymentGitSource16 = {
  type:
    CreateDeploymentGitSourceDeploymentsResponse200ApplicationJSONResponseBody16Type;
  ref: string;
  sha: string;
  owner?: string | undefined;
  slug?: string | undefined;
  workspaceUuid: string;
  repoUuid: string;
};

export const CreateDeploymentGitSourceDeploymentsResponse200ApplicationJSONResponseBody15Type =
  {
    Gitlab: "gitlab",
  } as const;
export type CreateDeploymentGitSourceDeploymentsResponse200ApplicationJSONResponseBody15Type =
  ClosedEnum<
    typeof CreateDeploymentGitSourceDeploymentsResponse200ApplicationJSONResponseBody15Type
  >;

export type CreateDeploymentGitSource15 = {
  type:
    CreateDeploymentGitSourceDeploymentsResponse200ApplicationJSONResponseBody15Type;
  ref: string;
  sha: string;
  projectId: number;
};

export const CreateDeploymentGitSourceDeploymentsResponse200ApplicationJSONResponseBody14Type =
  {
    GithubLimited: "github-limited",
  } as const;
export type CreateDeploymentGitSourceDeploymentsResponse200ApplicationJSONResponseBody14Type =
  ClosedEnum<
    typeof CreateDeploymentGitSourceDeploymentsResponse200ApplicationJSONResponseBody14Type
  >;

export type CreateDeploymentGitSource14 = {
  type:
    CreateDeploymentGitSourceDeploymentsResponse200ApplicationJSONResponseBody14Type;
  ref: string;
  sha: string;
  repoId: number;
  org?: string | undefined;
  repo?: string | undefined;
};

export const CreateDeploymentGitSourceDeploymentsResponse200ApplicationJSONResponseBody13Type =
  {
    GithubCustomHost: "github-custom-host",
  } as const;
export type CreateDeploymentGitSourceDeploymentsResponse200ApplicationJSONResponseBody13Type =
  ClosedEnum<
    typeof CreateDeploymentGitSourceDeploymentsResponse200ApplicationJSONResponseBody13Type
  >;

export type CreateDeploymentGitSource13 = {
  type:
    CreateDeploymentGitSourceDeploymentsResponse200ApplicationJSONResponseBody13Type;
  host: string;
  ref: string;
  sha: string;
  repoId: number;
  org?: string | undefined;
  repo?: string | undefined;
};

export const CreateDeploymentGitSourceDeploymentsResponse200ApplicationJSONResponseBody12Type =
  {
    Github: "github",
  } as const;
export type CreateDeploymentGitSourceDeploymentsResponse200ApplicationJSONResponseBody12Type =
  ClosedEnum<
    typeof CreateDeploymentGitSourceDeploymentsResponse200ApplicationJSONResponseBody12Type
  >;

export type CreateDeploymentGitSource12 = {
  type:
    CreateDeploymentGitSourceDeploymentsResponse200ApplicationJSONResponseBody12Type;
  ref: string;
  sha: string;
  repoId: number;
  org?: string | undefined;
  repo?: string | undefined;
};

export const CreateDeploymentGitSourceDeploymentsResponse200ApplicationJSONResponseBody11Type =
  {
    Custom: "custom",
  } as const;
export type CreateDeploymentGitSourceDeploymentsResponse200ApplicationJSONResponseBody11Type =
  ClosedEnum<
    typeof CreateDeploymentGitSourceDeploymentsResponse200ApplicationJSONResponseBody11Type
  >;

/**
 * Allows custom git sources (local folder mounted to the container) in test mode
 */
export type CreateDeploymentGitSource11 = {
  type:
    CreateDeploymentGitSourceDeploymentsResponse200ApplicationJSONResponseBody11Type;
  ref: string;
  sha: string;
  gitUrl: string;
};

export const CreateDeploymentGitSourceDeploymentsResponse200ApplicationJSONResponseBody10Type =
  {
    Vercel: "vercel",
  } as const;
export type CreateDeploymentGitSourceDeploymentsResponse200ApplicationJSONResponseBody10Type =
  ClosedEnum<
    typeof CreateDeploymentGitSourceDeploymentsResponse200ApplicationJSONResponseBody10Type
  >;

export type CreateDeploymentGitSource10 = {
  type:
    CreateDeploymentGitSourceDeploymentsResponse200ApplicationJSONResponseBody10Type;
  org?: string | undefined;
  repo?: string | undefined;
  sha: string;
  repoPushedAt?: number | undefined;
  ref?: string | null | undefined;
  prId?: number | null | undefined;
};

export const CreateDeploymentGitSourceDeploymentsResponse200ApplicationJSONResponseBody9Type =
  {
    Bitbucket: "bitbucket",
  } as const;
export type CreateDeploymentGitSourceDeploymentsResponse200ApplicationJSONResponseBody9Type =
  ClosedEnum<
    typeof CreateDeploymentGitSourceDeploymentsResponse200ApplicationJSONResponseBody9Type
  >;

export type CreateDeploymentGitSource9 = {
  type:
    CreateDeploymentGitSourceDeploymentsResponse200ApplicationJSONResponseBody9Type;
  owner: string;
  slug: string;
  ref?: string | null | undefined;
  sha?: string | undefined;
  prId?: number | null | undefined;
};

export const CreateDeploymentGitSourceDeploymentsResponse200ApplicationJSONResponseBody8Type =
  {
    Bitbucket: "bitbucket",
  } as const;
export type CreateDeploymentGitSourceDeploymentsResponse200ApplicationJSONResponseBody8Type =
  ClosedEnum<
    typeof CreateDeploymentGitSourceDeploymentsResponse200ApplicationJSONResponseBody8Type
  >;

export type CreateDeploymentGitSource8 = {
  type:
    CreateDeploymentGitSourceDeploymentsResponse200ApplicationJSONResponseBody8Type;
  workspaceUuid?: string | undefined;
  repoUuid: string;
  ref?: string | null | undefined;
  sha?: string | undefined;
  prId?: number | null | undefined;
};

export const CreateDeploymentGitSourceDeploymentsResponse200ApplicationJSONResponseBody7Type =
  {
    Gitlab: "gitlab",
  } as const;
export type CreateDeploymentGitSourceDeploymentsResponse200ApplicationJSONResponseBody7Type =
  ClosedEnum<
    typeof CreateDeploymentGitSourceDeploymentsResponse200ApplicationJSONResponseBody7Type
  >;

export type GitSourceProjectId = string | number;

export type CreateDeploymentGitSource7 = {
  type:
    CreateDeploymentGitSourceDeploymentsResponse200ApplicationJSONResponseBody7Type;
  projectId: string | number;
  ref?: string | null | undefined;
  sha?: string | undefined;
  prId?: number | null | undefined;
};

export const CreateDeploymentGitSourceDeploymentsResponse200ApplicationJSONResponseBody6Type =
  {
    GithubLimited: "github-limited",
  } as const;
export type CreateDeploymentGitSourceDeploymentsResponse200ApplicationJSONResponseBody6Type =
  ClosedEnum<
    typeof CreateDeploymentGitSourceDeploymentsResponse200ApplicationJSONResponseBody6Type
  >;

export type CreateDeploymentGitSource6 = {
  type:
    CreateDeploymentGitSourceDeploymentsResponse200ApplicationJSONResponseBody6Type;
  org: string;
  repo: string;
  ref?: string | null | undefined;
  sha?: string | undefined;
  prId?: number | null | undefined;
};

export const CreateDeploymentGitSourceDeploymentsResponse200ApplicationJSONResponseBody5Type =
  {
    GithubLimited: "github-limited",
  } as const;
export type CreateDeploymentGitSourceDeploymentsResponse200ApplicationJSONResponseBody5Type =
  ClosedEnum<
    typeof CreateDeploymentGitSourceDeploymentsResponse200ApplicationJSONResponseBody5Type
  >;

export type CreateDeploymentGitSourceDeploymentsResponseRepoId =
  | string
  | number;

export type CreateDeploymentGitSource5 = {
  type:
    CreateDeploymentGitSourceDeploymentsResponse200ApplicationJSONResponseBody5Type;
  repoId: string | number;
  ref?: string | null | undefined;
  sha?: string | undefined;
  prId?: number | null | undefined;
};

export const CreateDeploymentGitSourceDeploymentsResponse200ApplicationJSONResponseBodyType =
  {
    GithubCustomHost: "github-custom-host",
  } as const;
export type CreateDeploymentGitSourceDeploymentsResponse200ApplicationJSONResponseBodyType =
  ClosedEnum<
    typeof CreateDeploymentGitSourceDeploymentsResponse200ApplicationJSONResponseBodyType
  >;

export type CreateDeploymentGitSource4 = {
  type:
    CreateDeploymentGitSourceDeploymentsResponse200ApplicationJSONResponseBodyType;
  host: string;
  org: string;
  repo: string;
  ref?: string | null | undefined;
  sha?: string | undefined;
  prId?: number | null | undefined;
};

export const CreateDeploymentGitSourceDeploymentsResponse200ApplicationJSONType =
  {
    GithubCustomHost: "github-custom-host",
  } as const;
export type CreateDeploymentGitSourceDeploymentsResponse200ApplicationJSONType =
  ClosedEnum<
    typeof CreateDeploymentGitSourceDeploymentsResponse200ApplicationJSONType
  >;

export type CreateDeploymentGitSourceDeploymentsRepoId = string | number;

export type CreateDeploymentGitSource3 = {
  type: CreateDeploymentGitSourceDeploymentsResponse200ApplicationJSONType;
  host: string;
  repoId: string | number;
  ref?: string | null | undefined;
  sha?: string | undefined;
  prId?: number | null | undefined;
};

export const CreateDeploymentGitSourceDeploymentsResponse200Type = {
  Github: "github",
} as const;
export type CreateDeploymentGitSourceDeploymentsResponse200Type = ClosedEnum<
  typeof CreateDeploymentGitSourceDeploymentsResponse200Type
>;

export type CreateDeploymentGitSource2 = {
  type: CreateDeploymentGitSourceDeploymentsResponse200Type;
  org: string;
  repo: string;
  ref?: string | null | undefined;
  sha?: string | undefined;
  prId?: number | null | undefined;
};

export const CreateDeploymentGitSourceDeploymentsResponseType = {
  Github: "github",
} as const;
export type CreateDeploymentGitSourceDeploymentsResponseType = ClosedEnum<
  typeof CreateDeploymentGitSourceDeploymentsResponseType
>;

export type CreateDeploymentGitSourceRepoId = string | number;

export type CreateDeploymentGitSource1 = {
  type: CreateDeploymentGitSourceDeploymentsResponseType;
  repoId: string | number;
  ref?: string | null | undefined;
  sha?: string | undefined;
  prId?: number | null | undefined;
};

export type CreateDeploymentGitSource =
  | CreateDeploymentGitSource13
  | CreateDeploymentGitSource16
  | CreateDeploymentGitSource17
  | CreateDeploymentGitSource4
  | CreateDeploymentGitSource11
  | CreateDeploymentGitSource12
  | CreateDeploymentGitSource14
  | CreateDeploymentGitSource15
  | CreateDeploymentGitSource2
  | CreateDeploymentGitSource3
  | CreateDeploymentGitSource6
  | CreateDeploymentGitSource9
  | CreateDeploymentGitSource1
  | CreateDeploymentGitSource5
  | CreateDeploymentGitSource7
  | CreateDeploymentGitSource8
  | CreateDeploymentGitSource10;

/**
 * Current provisioning state
 */
export const CreateDeploymentState = {
  Complete: "COMPLETE",
  Pending: "PENDING",
  Timeout: "TIMEOUT",
} as const;
/**
 * Current provisioning state
 */
export type CreateDeploymentState = ClosedEnum<typeof CreateDeploymentState>;

/**
 * Present when deployment was created with manual provisioning enabled, either explicitly or via the experimental BYOC git flow. The deployment stays in INITIALIZING until /continue is called.
 */
export type ManualProvisioning = {
  /**
   * Current provisioning state
   */
  state: CreateDeploymentState;
  /**
   * Timestamp when manual provisioning completed
   */
  completedAt?: number | undefined;
};

/**
 * If set it overrides the `projectSettings.nodeVersion` for this deployment.
 */
export const CreateDeploymentNodeVersion = {
  TenDotX: "10.x",
  TwelveDotX: "12.x",
  FourteenDotX: "14.x",
  SixteenDotX: "16.x",
  EighteenDotX: "18.x",
  TwentyDotX: "20.x",
  TwentyTwoDotX: "22.x",
  TwentyFourDotX: "24.x",
  EightDot10DotX: "8.10.x",
} as const;
/**
 * If set it overrides the `projectSettings.nodeVersion` for this deployment.
 */
export type CreateDeploymentNodeVersion = ClosedEnum<
  typeof CreateDeploymentNodeVersion
>;

/**
 * The public project information associated with the deployment.
 */
export type CreateDeploymentProject = {
  id: string;
  name: string;
  framework?: string | null | undefined;
};

/**
 * Substate of deployment when readyState is 'READY' Tracks whether or not deployment has seen production traffic: - STAGED: never seen production traffic - ROLLING: in the process of having production traffic gradually transitioned. - PROMOTED: has seen production traffic
 */
export const ReadySubstate = {
  Promoted: "PROMOTED",
  Rolling: "ROLLING",
  Staged: "STAGED",
} as const;
/**
 * Substate of deployment when readyState is 'READY' Tracks whether or not deployment has seen production traffic: - STAGED: never seen production traffic - ROLLING: in the process of having production traffic gradually transitioned. - PROMOTED: has seen production traffic
 */
export type ReadySubstate = ClosedEnum<typeof ReadySubstate>;

/**
 * Where was the deployment created from. Best-effort guess for metrics only — not authoritative; do not gate behavior on it.
 */
export const CreateDeploymentSource = {
  ApiTriggerGitDeploy: "api-trigger-git-deploy",
  Cli: "cli",
  CloneRepo: "clone/repo",
  Drop: "drop",
  Git: "git",
  Import: "import",
  ImportRepo: "import/repo",
  Redeploy: "redeploy",
  V0Web: "v0-web",
} as const;
/**
 * Where was the deployment created from. Best-effort guess for metrics only — not authoritative; do not gate behavior on it.
 */
export type CreateDeploymentSource = ClosedEnum<typeof CreateDeploymentSource>;

/**
 * If defined, either `staging` if a staging alias in the format `<project>.<team>.now.sh` was assigned upon creation, or `production` if the aliases from `alias` were assigned. `null` value indicates the "preview" deployment.
 */
export const CreateDeploymentTarget = {
  Production: "production",
  Staging: "staging",
} as const;
/**
 * If defined, either `staging` if a staging alias in the format `<project>.<team>.now.sh` was assigned upon creation, or `production` if the aliases from `alias` were assigned. `null` value indicates the "preview" deployment.
 */
export type CreateDeploymentTarget = ClosedEnum<typeof CreateDeploymentTarget>;

export type OidcTokenClaims = {
  iss: string;
  sub: string;
  scope: string;
  aud: string;
  owner: string;
  ownerId: string;
  project: string;
  projectId: string;
  environment: string;
  customEnvironmentId?: string | undefined;
  plan?: string | undefined;
};

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

/**
 * The external platform that created the deployment (e.g. its display name).
 */
export type CreateDeploymentDeploymentsSource = {
  /**
   * Display name of the platform.
   */
  name: string;
};

/**
 * Whether the value is an opaque identifier or a URL.
 */
export const CreateDeploymentDeploymentsType = {
  Id: "id",
  Url: "url",
} as const;
/**
 * Whether the value is an opaque identifier or a URL.
 */
export type CreateDeploymentDeploymentsType = ClosedEnum<
  typeof CreateDeploymentDeploymentsType
>;

/**
 * Reference back to the entity on the platform that initiated the deployment.
 */
export type CreateDeploymentOrigin = {
  /**
   * Whether the value is an opaque identifier or a URL.
   */
  type: CreateDeploymentDeploymentsType;
  /**
   * The identifier or URL pointing to the originating entity.
   */
  value: string;
};

/**
 * The user on the external platform who triggered the deployment.
 */
export type CreateDeploymentDeploymentsCreator = {
  /**
   * Display name of the platform user.
   */
  name: string;
  /**
   * URL of the platform user's avatar image.
   */
  avatar?: string | undefined;
};

/**
 * Metadata about the source platform that triggered the deployment. Allows us to map a deployment back to a platform (e.g. the chat that created it)
 */
export type Platform = {
  /**
   * The external platform that created the deployment (e.g. its display name).
   */
  source: CreateDeploymentDeploymentsSource;
  /**
   * Reference back to the entity on the platform that initiated the deployment.
   */
  origin: CreateDeploymentOrigin;
  /**
   * The user on the external platform who triggered the deployment.
   */
  creator: CreateDeploymentDeploymentsCreator;
  /**
   * Arbitrary key-value metadata provided by the platform.
   */
  meta?: { [k: string]: string } | undefined;
};

export type Crons = {
  schedule: string;
  path: string;
};

export const Architecture = {
  Arm64: "arm64",
  X8664: "x86_64",
} as const;
export type Architecture = ClosedEnum<typeof Architecture>;

export const MaxDuration2 = {
  Max: "max",
} as const;
export type MaxDuration2 = ClosedEnum<typeof MaxDuration2>;

export type MaxDuration = number | MaxDuration2;

/**
 * Queue trigger input event for v2beta (from vercel.json config). Consumer name is implicitly derived from the function path. Only one trigger per function is allowed.
 */
export type ExperimentalTriggers2 = {
  /**
   * Event type - must be "queue/v2beta" (REQUIRED)
   */
  type: "queue/v2beta";
  /**
   * Name of the queue topic to consume from (REQUIRED)
   */
  topic: string;
  /**
   * Maximum number of delivery attempts for message processing (OPTIONAL) This represents the total number of times a message can be delivered, not the number of retries. Must be at least 1 if specified. Behavior when not specified depends on the server's default configuration.
   */
  maxDeliveries?: number | undefined;
  /**
   * Delay in seconds before retrying failed executions (OPTIONAL) Behavior when not specified depends on the server's default configuration.
   */
  retryAfterSeconds?: number | undefined;
  /**
   * Initial delay in seconds before first execution attempt (OPTIONAL) Must be 0 or greater. Use 0 for no initial delay. Behavior when not specified depends on the server's default configuration.
   */
  initialDelaySeconds?: number | undefined;
  /**
   * Maximum number of concurrent executions for this consumer (OPTIONAL) Must be at least 1 if specified. Behavior when not specified depends on the server's default configuration.
   */
  maxConcurrency?: number | undefined;
};

/**
 * Queue trigger input event for v1beta (from vercel.json config). Requires explicit consumer name.
 */
export type ExperimentalTriggers1 = {
  /**
   * Event type - must be "queue/v1beta" (REQUIRED)
   */
  type: "queue/v1beta";
  /**
   * Name of the consumer group for this trigger (REQUIRED)
   */
  consumer: string;
  /**
   * Name of the queue topic to consume from (REQUIRED)
   */
  topic: string;
  /**
   * Maximum number of delivery attempts for message processing (OPTIONAL) This represents the total number of times a message can be delivered, not the number of retries. Must be at least 1 if specified. Behavior when not specified depends on the server's default configuration.
   */
  maxDeliveries?: number | undefined;
  /**
   * Delay in seconds before retrying failed executions (OPTIONAL) Behavior when not specified depends on the server's default configuration.
   */
  retryAfterSeconds?: number | undefined;
  /**
   * Initial delay in seconds before first execution attempt (OPTIONAL) Must be 0 or greater. Use 0 for no initial delay. Behavior when not specified depends on the server's default configuration.
   */
  initialDelaySeconds?: number | undefined;
  /**
   * Maximum number of concurrent executions for this consumer (OPTIONAL) Must be at least 1 if specified. Behavior when not specified depends on the server's default configuration.
   */
  maxConcurrency?: number | undefined;
};

export type ExperimentalTriggers =
  | ExperimentalTriggers1
  | ExperimentalTriggers2;

export type Functions = {
  architecture?: Architecture | undefined;
  memory?: number | undefined;
  maxDuration?: number | MaxDuration2 | undefined;
  regions?: Array<string> | undefined;
  functionFailoverRegions?: Array<string> | undefined;
  runtime?: string | undefined;
  includeFiles?: string | undefined;
  excludeFiles?: string | undefined;
  experimentalTriggers?:
    | Array<ExperimentalTriggers1 | ExperimentalTriggers2>
    | undefined;
  supportsCancellation?: boolean | undefined;
};

export type Routes3 = {
  src: string;
  continue: boolean;
  middleware: number;
};

export const Handle = {
  Error: "error",
  Filesystem: "filesystem",
  Hit: "hit",
  Miss: "miss",
  Resource: "resource",
  Rewrite: "rewrite",
} as const;
export type Handle = ClosedEnum<typeof Handle>;

export type Routes2 = {
  handle: Handle;
  src?: string | undefined;
  dest?: string | undefined;
  status?: number | undefined;
};

export const CreateDeploymentHasType = {
  Cookie: "cookie",
  Header: "header",
  Query: "query",
} as const;
export type CreateDeploymentHasType = ClosedEnum<
  typeof CreateDeploymentHasType
>;

export type ValueEq = string | number;

export type CreateDeploymentValue2 = {
  eq?: string | number | undefined;
  neq?: string | undefined;
  inc?: Array<string> | undefined;
  ninc?: Array<string> | undefined;
  pre?: string | undefined;
  suf?: string | undefined;
  re?: string | undefined;
  gt?: number | undefined;
  gte?: number | undefined;
  lt?: number | undefined;
  lte?: number | undefined;
};

export type HasValue = string | CreateDeploymentValue2;

export type Has2 = {
  type: CreateDeploymentHasType;
  key: string;
  value?: string | CreateDeploymentValue2 | undefined;
};

export type Eq = string | number;

export type CreateDeploymentValueDeploymentsResponse2002 = {
  eq?: string | number | undefined;
  neq?: string | undefined;
  inc?: Array<string> | undefined;
  ninc?: Array<string> | undefined;
  pre?: string | undefined;
  suf?: string | undefined;
  re?: string | undefined;
  gt?: number | undefined;
  gte?: number | undefined;
  lt?: number | undefined;
  lte?: number | undefined;
};

export type CreateDeploymentHasValue =
  | string
  | CreateDeploymentValueDeploymentsResponse2002;

export type Has1 = {
  type: "host";
  value: string | CreateDeploymentValueDeploymentsResponse2002;
};

export type CreateDeploymentRoutesHas =
  | Has1
  | (Has2 & { type: "cookie" })
  | (Has2 & { type: "header" })
  | (Has2 & { type: "query" });

export const CreateDeploymentMissingType = {
  Cookie: "cookie",
  Header: "header",
  Query: "query",
} as const;
export type CreateDeploymentMissingType = ClosedEnum<
  typeof CreateDeploymentMissingType
>;

export type CreateDeploymentValueDeploymentsEq = string | number;

export type CreateDeploymentValueDeploymentsResponse2 = {
  eq?: string | number | undefined;
  neq?: string | undefined;
  inc?: Array<string> | undefined;
  ninc?: Array<string> | undefined;
  pre?: string | undefined;
  suf?: string | undefined;
  re?: string | undefined;
  gt?: number | undefined;
  gte?: number | undefined;
  lt?: number | undefined;
  lte?: number | undefined;
};

export type CreateDeploymentMissingValue =
  | string
  | CreateDeploymentValueDeploymentsResponse2;

export type Missing2 = {
  type: CreateDeploymentMissingType;
  key: string;
  value?: string | CreateDeploymentValueDeploymentsResponse2 | undefined;
};

export type CreateDeploymentValueEq = string | number;

export type CreateDeploymentValueDeployments2 = {
  eq?: string | number | undefined;
  neq?: string | undefined;
  inc?: Array<string> | undefined;
  ninc?: Array<string> | undefined;
  pre?: string | undefined;
  suf?: string | undefined;
  re?: string | undefined;
  gt?: number | undefined;
  gte?: number | undefined;
  lt?: number | undefined;
  lte?: number | undefined;
};

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

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

/** @internal */
export type UploadedFile$Outbound = {
  file: string;
  sha?: string | undefined;
  size?: number | undefined;
};

/** @internal */
export const UploadedFile$outboundSchema: z.ZodType<
  UploadedFile$Outbound,
  z.ZodTypeDef,
  UploadedFile
> = z.object({
  file: z.string(),
  sha: z.string().optional(),
  size: z.number().int().optional(),
});

export function uploadedFileToJSON(uploadedFile: UploadedFile): string {
  return JSON.stringify(UploadedFile$outboundSchema.parse(uploadedFile));
}

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

/** @internal */
export type InlinedFile$Outbound = {
  data: string;
  encoding?: string | undefined;
  file: string;
};

/** @internal */
export const InlinedFile$outboundSchema: z.ZodType<
  InlinedFile$Outbound,
  z.ZodTypeDef,
  InlinedFile
> = z.object({
  data: z.string(),
  encoding: Encoding$outboundSchema.optional(),
  file: z.string(),
});

export function inlinedFileToJSON(inlinedFile: InlinedFile): string {
  return JSON.stringify(InlinedFile$outboundSchema.parse(inlinedFile));
}

/** @internal */
export type Files$Outbound = InlinedFile$Outbound | UploadedFile$Outbound;

/** @internal */
export const Files$outboundSchema: z.ZodType<
  Files$Outbound,
  z.ZodTypeDef,
  Files
> = smartUnion([
  z.lazy(() => InlinedFile$outboundSchema),
  z.lazy(() => UploadedFile$outboundSchema),
]);

export function filesToJSON(files: Files): string {
  return JSON.stringify(Files$outboundSchema.parse(files));
}

/** @internal */
export type GitMetadata$Outbound = {
  remoteUrl?: string | undefined;
  commitAuthorName?: string | undefined;
  commitAuthorEmail?: string | undefined;
  commitMessage?: string | undefined;
  commitRef?: string | undefined;
  commitSha?: string | undefined;
  dirty?: boolean | undefined;
  ci?: boolean | undefined;
  ciType?: string | undefined;
  ciGitProviderUsername?: string | undefined;
  ciGitRepoVisibility?: string | undefined;
};

/** @internal */
export const GitMetadata$outboundSchema: z.ZodType<
  GitMetadata$Outbound,
  z.ZodTypeDef,
  GitMetadata
> = z.object({
  remoteUrl: z.string().optional(),
  commitAuthorName: z.string().optional(),
  commitAuthorEmail: z.string().optional(),
  commitMessage: z.string().optional(),
  commitRef: z.string().optional(),
  commitSha: z.string().optional(),
  dirty: z.boolean().optional(),
  ci: z.boolean().optional(),
  ciType: z.string().optional(),
  ciGitProviderUsername: z.string().optional(),
  ciGitRepoVisibility: z.string().optional(),
});

export function gitMetadataToJSON(gitMetadata: GitMetadata): string {
  return JSON.stringify(GitMetadata$outboundSchema.parse(gitMetadata));
}

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

/** @internal */
export type GitSource8$Outbound = {
  owner: string;
  ref: string;
  sha?: string | undefined;
  slug: string;
  type: string;
};

/** @internal */
export const GitSource8$outboundSchema: z.ZodType<
  GitSource8$Outbound,
  z.ZodTypeDef,
  GitSource8
> = z.object({
  owner: z.string(),
  ref: z.string(),
  sha: z.string().optional(),
  slug: z.string(),
  type:
    CreateDeploymentGitSourceDeploymentsRequestRequestBody8Type$outboundSchema,
});

export function gitSource8ToJSON(gitSource8: GitSource8): string {
  return JSON.stringify(GitSource8$outboundSchema.parse(gitSource8));
}

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

/** @internal */
export type GitSource7$Outbound = {
  ref: string;
  repoUuid: string;
  sha?: string | undefined;
  type: string;
  workspaceUuid?: string | undefined;
};

/** @internal */
export const GitSource7$outboundSchema: z.ZodType<
  GitSource7$Outbound,
  z.ZodTypeDef,
  GitSource7
> = z.object({
  ref: z.string(),
  repoUuid: z.string(),
  sha: z.string().optional(),
  type:
    CreateDeploymentGitSourceDeploymentsRequestRequestBody7Type$outboundSchema,
  workspaceUuid: z.string().optional(),
});

export function gitSource7ToJSON(gitSource7: GitSource7): string {
  return JSON.stringify(GitSource7$outboundSchema.parse(gitSource7));
}

/** @internal */
export type ProjectId$Outbound = number | string;

/** @internal */
export const ProjectId$outboundSchema: z.ZodType<
  ProjectId$Outbound,
  z.ZodTypeDef,
  ProjectId
> = smartUnion([z.number(), z.string()]);

export function projectIdToJSON(projectId: ProjectId): string {
  return JSON.stringify(ProjectId$outboundSchema.parse(projectId));
}

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

/** @internal */
export type GitSource6$Outbound = {
  projectId: number | string;
  ref: string;
  sha?: string | undefined;
  type: string;
};

/** @internal */
export const GitSource6$outboundSchema: z.ZodType<
  GitSource6$Outbound,
  z.ZodTypeDef,
  GitSource6
> = z.object({
  projectId: smartUnion([z.number(), z.string()]),
  ref: z.string(),
  sha: z.string().optional(),
  type:
    CreateDeploymentGitSourceDeploymentsRequestRequestBody6Type$outboundSchema,
});

export function gitSource6ToJSON(gitSource6: GitSource6): string {
  return JSON.stringify(GitSource6$outboundSchema.parse(gitSource6));
}

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

/** @internal */
export type GitSource5$Outbound = {
  org: string;
  ref: string;
  repo: string;
  sha?: string | undefined;
  type: string;
};

/** @internal */
export const GitSource5$outboundSchema: z.ZodType<
  GitSource5$Outbound,
  z.ZodTypeDef,
  GitSource5
> = z.object({
  org: z.string(),
  ref: z.string(),
  repo: z.string(),
  sha: z.string().optional(),
  type:
    CreateDeploymentGitSourceDeploymentsRequestRequestBodyType$outboundSchema,
});

export function gitSource5ToJSON(gitSource5: GitSource5): string {
  return JSON.stringify(GitSource5$outboundSchema.parse(gitSource5));
}

/** @internal */
export type GitSourceRepoId$Outbound = number | string;

/** @internal */
export const GitSourceRepoId$outboundSchema: z.ZodType<
  GitSourceRepoId$Outbound,
  z.ZodTypeDef,
  GitSourceRepoId
> = smartUnion([z.number(), z.string()]);

export function gitSourceRepoIdToJSON(
  gitSourceRepoId: GitSourceRepoId,
): string {
  return JSON.stringify(GitSourceRepoId$outboundSchema.parse(gitSourceRepoId));
}

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

/** @internal */
export type GitSource4$Outbound = {
  ref: string;
  repoId: number | string;
  sha?: string | undefined;
  type: string;
};

/** @internal */
export const GitSource4$outboundSchema: z.ZodType<
  GitSource4$Outbound,
  z.ZodTypeDef,
  GitSource4
> = z.object({
  ref: z.string(),
  repoId: smartUnion([z.number(), z.string()]),
  sha: z.string().optional(),
  type: CreateDeploymentGitSourceDeploymentsRequestType$outboundSchema,
});

export function gitSource4ToJSON(gitSource4: GitSource4): string {
  return JSON.stringify(GitSource4$outboundSchema.parse(gitSource4));
}

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

/** @internal */
export type GitSource3$Outbound = {
  org: string;
  ref: string;
  repo: string;
  sha?: string | undefined;
  type: string;
};

/** @internal */
export const GitSource3$outboundSchema: z.ZodType<
  GitSource3$Outbound,
  z.ZodTypeDef,
  GitSource3
> = z.object({
  org: z.string(),
  ref: z.string(),
  repo: z.string(),
  sha: z.string().optional(),
  type: CreateDeploymentGitSourceDeploymentsType$outboundSchema,
});

export function gitSource3ToJSON(gitSource3: GitSource3): string {
  return JSON.stringify(GitSource3$outboundSchema.parse(gitSource3));
}

/** @internal */
export type RepoId$Outbound = number | string;

/** @internal */
export const RepoId$outboundSchema: z.ZodType<
  RepoId$Outbound,
  z.ZodTypeDef,
  RepoId
> = smartUnion([z.number(), z.string()]);

export function repoIdToJSON(repoId: RepoId): string {
  return JSON.stringify(RepoId$outboundSchema.parse(repoId));
}

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

/** @internal */
export type GitSource2$Outbound = {
  ref: string;
  repoId: number | string;
  sha?: string | undefined;
  type: string;
};

/** @internal */
export const GitSource2$outboundSchema: z.ZodType<
  GitSource2$Outbound,
  z.ZodTypeDef,
  GitSource2
> = z.object({
  ref: z.string(),
  repoId: smartUnion([z.number(), z.string()]),
  sha: z.string().optional(),
  type: CreateDeploymentGitSourceType$outboundSchema,
});

export function gitSource2ToJSON(gitSource2: GitSource2): string {
  return JSON.stringify(GitSource2$outboundSchema.parse(gitSource2));
}

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

/** @internal */
export type GitSource1$Outbound = {
  type: string;
  sha: string;
};

/** @internal */
export const GitSource1$outboundSchema: z.ZodType<
  GitSource1$Outbound,
  z.ZodTypeDef,
  GitSource1
> = z.object({
  type: GitSourceType$outboundSchema,
  sha: z.string(),
});

export function gitSource1ToJSON(gitSource1: GitSource1): string {
  return JSON.stringify(GitSource1$outboundSchema.parse(gitSource1));
}

/** @internal */
export type GitSource$Outbound =
  | GitSource3$Outbound
  | GitSource5$Outbound
  | GitSource8$Outbound
  | GitSource2$Outbound
  | GitSource4$Outbound
  | GitSource6$Outbound
  | GitSource7$Outbound
  | GitSource1$Outbound;

/** @internal */
export const GitSource$outboundSchema: z.ZodType<
  GitSource$Outbound,
  z.ZodTypeDef,
  GitSource
> = smartUnion([
  z.lazy(() => GitSource3$outboundSchema),
  z.lazy(() => GitSource5$outboundSchema),
  z.lazy(() => GitSource8$outboundSchema),
  z.lazy(() => GitSource2$outboundSchema),
  z.lazy(() => GitSource4$outboundSchema),
  z.lazy(() => GitSource6$outboundSchema),
  z.lazy(() => GitSource7$outboundSchema),
  z.lazy(() => GitSource1$outboundSchema),
]);

export function gitSourceToJSON(gitSource: GitSource): string {
  return JSON.stringify(GitSource$outboundSchema.parse(gitSource));
}

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

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

/** @internal */
export type ProjectSettings$Outbound = {
  buildCommand?: string | null | undefined;
  commandForIgnoringBuildStep?: string | null | undefined;
  devCommand?: string | null | undefined;
  framework?: string | null | undefined;
  installCommand?: string | null | undefined;
  nodeVersion?: string | undefined;
  outputDirectory?: string | null | undefined;
  rootDirectory?: string | null | undefined;
  serverlessFunctionRegion?: string | null | undefined;
  skipGitConnectDuringLink?: boolean | undefined;
  sourceFilesOutsideRootDirectory?: boolean | undefined;
};

/** @internal */
export const ProjectSettings$outboundSchema: z.ZodType<
  ProjectSettings$Outbound,
  z.ZodTypeDef,
  ProjectSettings
> = z.object({
  buildCommand: z.nullable(z.string()).optional(),
  commandForIgnoringBuildStep: z.nullable(z.string()).optional(),
  devCommand: z.nullable(z.string()).optional(),
  framework: z.nullable(Framework$outboundSchema).optional(),
  installCommand: z.nullable(z.string()).optional(),
  nodeVersion: NodeVersion$outboundSchema.optional(),
  outputDirectory: z.nullable(z.string()).optional(),
  rootDirectory: z.nullable(z.string()).optional(),
  serverlessFunctionRegion: z.nullable(z.string()).optional(),
  skipGitConnectDuringLink: z.boolean().optional(),
  sourceFilesOutsideRootDirectory: z.boolean().optional(),
});

export function projectSettingsToJSON(
  projectSettings: ProjectSettings,
): string {
  return JSON.stringify(ProjectSettings$outboundSchema.parse(projectSettings));
}

/** @internal */
export type CreateDeploymentRequestBody$Outbound = {
  customEnvironmentSlugOrId?: string | undefined;
  deploymentId?: string | undefined;
  files?: Array<InlinedFile$Outbound | UploadedFile$Outbound> | undefined;
  gitMetadata?: GitMetadata$Outbound | undefined;
  gitSource?:
    | GitSource3$Outbound
    | GitSource5$Outbound
    | GitSource8$Outbound
    | GitSource2$Outbound
    | GitSource4$Outbound
    | GitSource6$Outbound
    | GitSource7$Outbound
    | GitSource1$Outbound
    | undefined;
  meta?: { [k: string]: string } | undefined;
  monorepoManager?: string | null | undefined;
  name: string;
  project?: string | undefined;
  projectSettings?: ProjectSettings$Outbound | undefined;
  target?: string | undefined;
  withLatestCommit?: boolean | undefined;
};

/** @internal */
export const CreateDeploymentRequestBody$outboundSchema: z.ZodType<
  CreateDeploymentRequestBody$Outbound,
  z.ZodTypeDef,
  CreateDeploymentRequestBody
> = z.object({
  customEnvironmentSlugOrId: z.string().optional(),
  deploymentId: z.string().optional(),
  files: z.array(
    smartUnion([
      z.lazy(() => InlinedFile$outboundSchema),
      z.lazy(() => UploadedFile$outboundSchema),
    ]),
  ).optional(),
  gitMetadata: z.lazy(() => GitMetadata$outboundSchema).optional(),
  gitSource: smartUnion([
    z.lazy(() => GitSource3$outboundSchema),
    z.lazy(() => GitSource5$outboundSchema),
    z.lazy(() => GitSource8$outboundSchema),
    z.lazy(() => GitSource2$outboundSchema),
    z.lazy(() => GitSource4$outboundSchema),
    z.lazy(() => GitSource6$outboundSchema),
    z.lazy(() => GitSource7$outboundSchema),
    z.lazy(() => GitSource1$outboundSchema),
  ]).optional(),
  meta: z.record(z.string()).optional(),
  monorepoManager: z.nullable(z.string()).optional(),
  name: z.string(),
  project: z.string().optional(),
  projectSettings: z.lazy(() => ProjectSettings$outboundSchema).optional(),
  target: z.string().optional(),
  withLatestCommit: z.boolean().optional(),
});

export function createDeploymentRequestBodyToJSON(
  createDeploymentRequestBody: CreateDeploymentRequestBody,
): string {
  return JSON.stringify(
    CreateDeploymentRequestBody$outboundSchema.parse(
      createDeploymentRequestBody,
    ),
  );
}

/** @internal */
export type CreateDeploymentRequest$Outbound = {
  forceNew?: string | undefined;
  skipAutoDetectionConfirmation?: string | undefined;
  teamId?: string | undefined;
  slug?: string | undefined;
  RequestBody: CreateDeploymentRequestBody$Outbound;
};

/** @internal */
export const CreateDeploymentRequest$outboundSchema: z.ZodType<
  CreateDeploymentRequest$Outbound,
  z.ZodTypeDef,
  CreateDeploymentRequest
> = z.object({
  forceNew: ForceNew$outboundSchema.optional(),
  skipAutoDetectionConfirmation: SkipAutoDetectionConfirmation$outboundSchema
    .optional(),
  teamId: z.string().optional(),
  slug: z.string().optional(),
  requestBody: z.lazy(() => CreateDeploymentRequestBody$outboundSchema),
}).transform((v) => {
  return remap$(v, {
    requestBody: "RequestBody",
  });
});

export function createDeploymentRequestToJSON(
  createDeploymentRequest: CreateDeploymentRequest,
): string {
  return JSON.stringify(
    CreateDeploymentRequest$outboundSchema.parse(createDeploymentRequest),
  );
}

/** @internal */
export const AliasAssignedAt$inboundSchema: z.ZodType<
  AliasAssignedAt,
  z.ZodTypeDef,
  unknown
> = smartUnion([types.number(), types.boolean()]);

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

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

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

/** @internal */
export const Builds$inboundSchema: z.ZodType<Builds, z.ZodTypeDef, unknown> = z
  .object({
    use: types.string(),
    src: types.optional(types.string()),
    config: types.optional(z.record(z.any())),
  });

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

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

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

/** @internal */
export const CreateDeploymentSpeedInsights$inboundSchema: z.ZodType<
  CreateDeploymentSpeedInsights,
  z.ZodTypeDef,
  unknown
> = z.object({
  id: types.string(),
  enabledAt: types.optional(types.number()),
  disabledAt: types.optional(types.number()),
  canceledAt: types.optional(types.number()),
  hasData: types.optional(types.boolean()),
  paidAt: types.optional(types.number()),
});

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

/** @internal */
export const CreateDeploymentWebAnalytics$inboundSchema: z.ZodType<
  CreateDeploymentWebAnalytics,
  z.ZodTypeDef,
  unknown
> = z.object({
  id: types.string(),
  disabledAt: types.optional(types.number()),
  canceledAt: types.optional(types.number()),
  enabledAt: types.optional(types.number()),
  hasData: types.optional(types.literal(true)),
});

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

/** @internal */
export const CreateDeploymentProjectSettings$inboundSchema: z.ZodType<
  CreateDeploymentProjectSettings,
  z.ZodTypeDef,
  unknown
> = z.object({
  nodeVersion: types.optional(
    CreateDeploymentDeploymentsNodeVersion$inboundSchema,
  ),
  buildCommand: z.nullable(types.string()).optional(),
  devCommand: z.nullable(types.string()).optional(),
  framework: z.nullable(CreateDeploymentFramework$inboundSchema).optional(),
  commandForIgnoringBuildStep: z.nullable(types.string()).optional(),
  installCommand: z.nullable(types.string()).optional(),
  outputDirectory: z.nullable(types.string()).optional(),
  speedInsights: types.optional(
    z.lazy(() => CreateDeploymentSpeedInsights$inboundSchema),
  ),
  webAnalytics: types.optional(
    z.lazy(() => CreateDeploymentWebAnalytics$inboundSchema),
  ),
});

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

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

/** @internal */
export const Integrations$inboundSchema: z.ZodType<
  Integrations,
  z.ZodTypeDef,
  unknown
> = z.object({
  status: CreateDeploymentDeploymentsStatus$inboundSchema,
  startedAt: types.number(),
  claimedAt: types.optional(types.number()),
  completedAt: types.optional(types.number()),
  skippedAt: types.optional(types.number()),
  skippedBy: types.optional(types.string()),
});

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

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

/** @internal */
export const RemotePatterns$inboundSchema: z.ZodType<
  RemotePatterns,
  z.ZodTypeDef,
  unknown
> = z.object({
  protocol: types.optional(Protocol$inboundSchema),
  hostname: types.string(),
  port: types.optional(types.string()),
  pathname: types.optional(types.string()),
  search: types.optional(types.string()),
});

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

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

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

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

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

/** @internal */
export const Images$inboundSchema: z.ZodType<Images, z.ZodTypeDef, unknown> = z
  .object({
    sizes: types.optional(z.array(types.number())),
    qualities: types.optional(z.array(types.number())),
    domains: types.optional(z.array(types.string())),
    remotePatterns: types.optional(
      z.array(z.lazy(() => RemotePatterns$inboundSchema)),
    ),
    localPatterns: types.optional(
      z.array(z.lazy(() => LocalPatterns$inboundSchema)),
    ),
    minimumCacheTTL: types.optional(types.number()),
    formats: types.optional(z.array(Formats$inboundSchema)),
    dangerouslyAllowSVG: types.optional(types.boolean()),
    contentSecurityPolicy: types.optional(types.string()),
    contentDispositionType: types.optional(
      ContentDispositionType$inboundSchema,
    ),
  });

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

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

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

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

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

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

/** @internal */
export const Lambdas$inboundSchema: z.ZodType<Lambdas, z.ZodTypeDef, unknown> =
  z.object({
    id: types.string(),
    createdAt: types.optional(types.number()),
    readyState: types.optional(CreateDeploymentReadyState$inboundSchema),
    entrypoint: z.nullable(types.string()).optional(),
    readyStateAt: types.optional(types.number()),
    output: z.array(z.lazy(() => CreateDeploymentOutput$inboundSchema)),
  });

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

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

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

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

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

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

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

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

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

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

/** @internal */
export const CreateDeploymentCustomEnvironmentVerification$inboundSchema:
  z.ZodType<
    CreateDeploymentCustomEnvironmentVerification,
    z.ZodTypeDef,
    unknown
  > = z.object({
    type: types.string(),
    domain: types.string(),
    value: types.string(),
    reason: types.string(),
  });

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

/** @internal */
export const CreateDeploymentCustomEnvironmentDomains$inboundSchema: z.ZodType<
  CreateDeploymentCustomEnvironmentDomains,
  z.ZodTypeDef,
  unknown
> = z.object({
  name: types.string(),
  apexName: types.string(),
  projectId: types.string(),
  redirect: z.nullable(types.string()).optional(),
  redirectStatusCode: z.nullable(types.number()).optional(),
  gitBranch: z.nullable(types.string()).optional(),
  customEnvironmentId: z.nullable(types.string()).optional(),
  updatedAt: types.optional(types.number()),
  createdAt: types.optional(types.number()),
  verified: types.boolean(),
  verification: types.optional(
    z.array(z.lazy(() =>
      CreateDeploymentCustomEnvironmentVerification$inboundSchema
    )),
  ),
});

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

/** @internal */
export const CustomEnvironment1$inboundSchema: z.ZodType<
  CustomEnvironment1,
  z.ZodTypeDef,
  unknown
> = z.object({
  id: types.string(),
  slug: types.string(),
  type: CustomEnvironmentType$inboundSchema,
  description: types.optional(types.string()),
  branchMatcher: types.optional(
    z.lazy(() => CreateDeploymentCustomEnvironmentBranchMatcher$inboundSchema),
  ),
  domains: types.optional(
    z.array(
      z.lazy(() => CreateDeploymentCustomEnvironmentDomains$inboundSchema),
    ),
  ),
  currentDeploymentAliases: types.optional(z.array(types.string())),
  createdAt: types.number(),
  updatedAt: types.number(),
});

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

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

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

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

/** @internal */
export const AliasWarning$inboundSchema: z.ZodType<
  AliasWarning,
  z.ZodTypeDef,
  unknown
> = z.object({
  code: types.string(),
  message: types.string(),
  link: types.optional(types.string()),
  action: types.optional(types.string()),
});

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

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

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

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

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

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

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

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

/** @internal */
export const CreateDeploymentGitSource17$inboundSchema: z.ZodType<
  CreateDeploymentGitSource17,
  z.ZodTypeDef,
  unknown
> = z.object({
  type:
    CreateDeploymentGitSourceDeploymentsResponse200ApplicationJSONResponseBody17Type$inboundSchema,
  ref: types.string(),
  sha: types.string(),
  org: types.string(),
  repo: types.string(),
  repoPushedAt: types.optional(types.number()),
});

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

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

/** @internal */
export const CreateDeploymentGitSource16$inboundSchema: z.ZodType<
  CreateDeploymentGitSource16,
  z.ZodTypeDef,
  unknown
> = z.object({
  type:
    CreateDeploymentGitSourceDeploymentsResponse200ApplicationJSONResponseBody16Type$inboundSchema,
  ref: types.string(),
  sha: types.string(),
  owner: types.optional(types.string()),
  slug: types.optional(types.string()),
  workspaceUuid: types.string(),
  repoUuid: types.string(),
});

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

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

/** @internal */
export const CreateDeploymentGitSource15$inboundSchema: z.ZodType<
  CreateDeploymentGitSource15,
  z.ZodTypeDef,
  unknown
> = z.object({
  type:
    CreateDeploymentGitSourceDeploymentsResponse200ApplicationJSONResponseBody15Type$inboundSchema,
  ref: types.string(),
  sha: types.string(),
  projectId: types.number(),
});

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

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

/** @internal */
export const CreateDeploymentGitSource14$inboundSchema: z.ZodType<
  CreateDeploymentGitSource14,
  z.ZodTypeDef,
  unknown
> = z.object({
  type:
    CreateDeploymentGitSourceDeploymentsResponse200ApplicationJSONResponseBody14Type$inboundSchema,
  ref: types.string(),
  sha: types.string(),
  repoId: types.number(),
  org: types.optional(types.string()),
  repo: types.optional(types.string()),
});

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

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

/** @internal */
export const CreateDeploymentGitSource13$inboundSchema: z.ZodType<
  CreateDeploymentGitSource13,
  z.ZodTypeDef,
  unknown
> = z.object({
  type:
    CreateDeploymentGitSourceDeploymentsResponse200ApplicationJSONResponseBody13Type$inboundSchema,
  host: types.string(),
  ref: types.string(),
  sha: types.string(),
  repoId: types.number(),
  org: types.optional(types.string()),
  repo: types.optional(types.string()),
});

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

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

/** @internal */
export const CreateDeploymentGitSource12$inboundSchema: z.ZodType<
  CreateDeploymentGitSource12,
  z.ZodTypeDef,
  unknown
> = z.object({
  type:
    CreateDeploymentGitSourceDeploymentsResponse200ApplicationJSONResponseBody12Type$inboundSchema,
  ref: types.string(),
  sha: types.string(),
  repoId: types.number(),
  org: types.optional(types.string()),
  repo: types.optional(types.string()),
});

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

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

/** @internal */
export const CreateDeploymentGitSource11$inboundSchema: z.ZodType<
  CreateDeploymentGitSource11,
  z.ZodTypeDef,
  unknown
> = z.object({
  type:
    CreateDeploymentGitSourceDeploymentsResponse200ApplicationJSONResponseBody11Type$inboundSchema,
  ref: types.string(),
  sha: types.string(),
  gitUrl: types.string(),
});

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

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

/** @internal */
export const CreateDeploymentGitSource10$inboundSchema: z.ZodType<
  CreateDeploymentGitSource10,
  z.ZodTypeDef,
  unknown
> = z.object({
  type:
    CreateDeploymentGitSourceDeploymentsResponse200ApplicationJSONResponseBody10Type$inboundSchema,
  org: types.optional(types.string()),
  repo: types.optional(types.string()),
  sha: types.string(),
  repoPushedAt: types.optional(types.number()),
  ref: z.nullable(types.string()).optional(),
  prId: z.nullable(types.number()).optional(),
});

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

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

/** @internal */
export const CreateDeploymentGitSource9$inboundSchema: z.ZodType<
  CreateDeploymentGitSource9,
  z.ZodTypeDef,
  unknown
> = z.object({
  type:
    CreateDeploymentGitSourceDeploymentsResponse200ApplicationJSONResponseBody9Type$inboundSchema,
  owner: types.string(),
  slug: types.string(),
  ref: z.nullable(types.string()).optional(),
  sha: types.optional(types.string()),
  prId: z.nullable(types.number()).optional(),
});

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

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

/** @internal */
export const CreateDeploymentGitSource8$inboundSchema: z.ZodType<
  CreateDeploymentGitSource8,
  z.ZodTypeDef,
  unknown
> = z.object({
  type:
    CreateDeploymentGitSourceDeploymentsResponse200ApplicationJSONResponseBody8Type$inboundSchema,
  workspaceUuid: types.optional(types.string()),
  repoUuid: types.string(),
  ref: z.nullable(types.string()).optional(),
  sha: types.optional(types.string()),
  prId: z.nullable(types.number()).optional(),
});

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

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

/** @internal */
export const GitSourceProjectId$inboundSchema: z.ZodType<
  GitSourceProjectId,
  z.ZodTypeDef,
  unknown
> = smartUnion([types.string(), types.number()]);

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

/** @internal */
export const CreateDeploymentGitSource7$inboundSchema: z.ZodType<
  CreateDeploymentGitSource7,
  z.ZodTypeDef,
  unknown
> = z.object({
  type:
    CreateDeploymentGitSourceDeploymentsResponse200ApplicationJSONResponseBody7Type$inboundSchema,
  projectId: smartUnion([types.string(), types.number()]),
  ref: z.nullable(types.string()).optional(),
  sha: types.optional(types.string()),
  prId: z.nullable(types.number()).optional(),
});

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

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

/** @internal */
export const CreateDeploymentGitSource6$inboundSchema: z.ZodType<
  CreateDeploymentGitSource6,
  z.ZodTypeDef,
  unknown
> = z.object({
  type:
    CreateDeploymentGitSourceDeploymentsResponse200ApplicationJSONResponseBody6Type$inboundSchema,
  org: types.string(),
  repo: types.string(),
  ref: z.nullable(types.string()).optional(),
  sha: types.optional(types.string()),
  prId: z.nullable(types.number()).optional(),
});

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

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

/** @internal */
export const CreateDeploymentGitSourceDeploymentsResponseRepoId$inboundSchema:
  z.ZodType<
    CreateDeploymentGitSourceDeploymentsResponseRepoId,
    z.ZodTypeDef,
    unknown
  > = smartUnion([types.string(), types.number()]);

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

/** @internal */
export const CreateDeploymentGitSource5$inboundSchema: z.ZodType<
  CreateDeploymentGitSource5,
  z.ZodTypeDef,
  unknown
> = z.object({
  type:
    CreateDeploymentGitSourceDeploymentsResponse200ApplicationJSONResponseBody5Type$inboundSchema,
  repoId: smartUnion([types.string(), types.number()]),
  ref: z.nullable(types.string()).optional(),
  sha: types.optional(types.string()),
  prId: z.nullable(types.number()).optional(),
});

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

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

/** @internal */
export const CreateDeploymentGitSource4$inboundSchema: z.ZodType<
  CreateDeploymentGitSource4,
  z.ZodTypeDef,
  unknown
> = z.object({
  type:
    CreateDeploymentGitSourceDeploymentsResponse200ApplicationJSONResponseBodyType$inboundSchema,
  host: types.string(),
  org: types.string(),
  repo: types.string(),
  ref: z.nullable(types.string()).optional(),
  sha: types.optional(types.string()),
  prId: z.nullable(types.number()).optional(),
});

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

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

/** @internal */
export const CreateDeploymentGitSourceDeploymentsRepoId$inboundSchema:
  z.ZodType<CreateDeploymentGitSourceDeploymentsRepoId, z.ZodTypeDef, unknown> =
    smartUnion([types.string(), types.number()]);

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

/** @internal */
export const CreateDeploymentGitSource3$inboundSchema: z.ZodType<
  CreateDeploymentGitSource3,
  z.ZodTypeDef,
  unknown
> = z.object({
  type:
    CreateDeploymentGitSourceDeploymentsResponse200ApplicationJSONType$inboundSchema,
  host: types.string(),
  repoId: smartUnion([types.string(), types.number()]),
  ref: z.nullable(types.string()).optional(),
  sha: types.optional(types.string()),
  prId: z.nullable(types.number()).optional(),
});

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

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

/** @internal */
export const CreateDeploymentGitSource2$inboundSchema: z.ZodType<
  CreateDeploymentGitSource2,
  z.ZodTypeDef,
  unknown
> = z.object({
  type: CreateDeploymentGitSourceDeploymentsResponse200Type$inboundSchema,
  org: types.string(),
  repo: types.string(),
  ref: z.nullable(types.string()).optional(),
  sha: types.optional(types.string()),
  prId: z.nullable(types.number()).optional(),
});

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

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

/** @internal */
export const CreateDeploymentGitSourceRepoId$inboundSchema: z.ZodType<
  CreateDeploymentGitSourceRepoId,
  z.ZodTypeDef,
  unknown
> = smartUnion([types.string(), types.number()]);

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

/** @internal */
export const CreateDeploymentGitSource1$inboundSchema: z.ZodType<
  CreateDeploymentGitSource1,
  z.ZodTypeDef,
  unknown
> = z.object({
  type: CreateDeploymentGitSourceDeploymentsResponseType$inboundSchema,
  repoId: smartUnion([types.string(), types.number()]),
  ref: z.nullable(types.string()).optional(),
  sha: types.optional(types.string()),
  prId: z.nullable(types.number()).optional(),
});

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

/** @internal */
export const CreateDeploymentGitSource$inboundSchema: z.ZodType<
  CreateDeploymentGitSource,
  z.ZodTypeDef,
  unknown
> = smartUnion([
  z.lazy(() => CreateDeploymentGitSource13$inboundSchema),
  z.lazy(() => CreateDeploymentGitSource16$inboundSchema),
  z.lazy(() => CreateDeploymentGitSource17$inboundSchema),
  z.lazy(() => CreateDeploymentGitSource4$inboundSchema),
  z.lazy(() => CreateDeploymentGitSource11$inboundSchema),
  z.lazy(() => CreateDeploymentGitSource12$inboundSchema),
  z.lazy(() => CreateDeploymentGitSource14$inboundSchema),
  z.lazy(() => CreateDeploymentGitSource15$inboundSchema),
  z.lazy(() => CreateDeploymentGitSource2$inboundSchema),
  z.lazy(() => CreateDeploymentGitSource3$inboundSchema),
  z.lazy(() => CreateDeploymentGitSource6$inboundSchema),
  z.lazy(() => CreateDeploymentGitSource9$inboundSchema),
  z.lazy(() => CreateDeploymentGitSource1$inboundSchema),
  z.lazy(() => CreateDeploymentGitSource5$inboundSchema),
  z.lazy(() => CreateDeploymentGitSource7$inboundSchema),
  z.lazy(() => CreateDeploymentGitSource8$inboundSchema),
  z.lazy(() => CreateDeploymentGitSource10$inboundSchema),
]);

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

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

/** @internal */
export const ManualProvisioning$inboundSchema: z.ZodType<
  ManualProvisioning,
  z.ZodTypeDef,
  unknown
> = z.object({
  state: CreateDeploymentState$inboundSchema,
  completedAt: types.optional(types.number()),
});

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

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

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

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

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

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

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

/** @internal */
export const OidcTokenClaims$inboundSchema: z.ZodType<
  OidcTokenClaims,
  z.ZodTypeDef,
  unknown
> = z.object({
  iss: types.string(),
  sub: types.string(),
  scope: types.string(),
  aud: types.string(),
  owner: types.string(),
  owner_id: types.string(),
  project: types.string(),
  project_id: types.string(),
  environment: types.string(),
  custom_environment_id: types.optional(types.string()),
  plan: types.optional(types.string()),
}).transform((v) => {
  return remap$(v, {
    "owner_id": "ownerId",
    "project_id": "projectId",
    "custom_environment_id": "customEnvironmentId",
  });
});

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

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

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

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

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

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

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

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

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

/** @internal */
export const Platform$inboundSchema: z.ZodType<
  Platform,
  z.ZodTypeDef,
  unknown
> = z.object({
  source: z.lazy(() => CreateDeploymentDeploymentsSource$inboundSchema),
  origin: z.lazy(() => CreateDeploymentOrigin$inboundSchema),
  creator: z.lazy(() => CreateDeploymentDeploymentsCreator$inboundSchema),
  meta: types.optional(z.record(types.string())),
});

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

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

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

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

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

/** @internal */
export const MaxDuration$inboundSchema: z.ZodType<
  MaxDuration,
  z.ZodTypeDef,
  unknown
> = smartUnion([types.number(), MaxDuration2$inboundSchema]);

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

/** @internal */
export const ExperimentalTriggers2$inboundSchema: z.ZodType<
  ExperimentalTriggers2,
  z.ZodTypeDef,
  unknown
> = z.object({
  type: types.literal("queue/v2beta"),
  topic: types.string(),
  maxDeliveries: types.optional(types.number()),
  retryAfterSeconds: types.optional(types.number()),
  initialDelaySeconds: types.optional(types.number()),
  maxConcurrency: types.optional(types.number()),
});

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

/** @internal */
export const ExperimentalTriggers1$inboundSchema: z.ZodType<
  ExperimentalTriggers1,
  z.ZodTypeDef,
  unknown
> = z.object({
  type: types.literal("queue/v1beta"),
  consumer: types.string(),
  topic: types.string(),
  maxDeliveries: types.optional(types.number()),
  retryAfterSeconds: types.optional(types.number()),
  initialDelaySeconds: types.optional(types.number()),
  maxConcurrency: types.optional(types.number()),
});

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

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

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

/** @internal */
export const Functions$inboundSchema: z.ZodType<
  Functions,
  z.ZodTypeDef,
  unknown
> = z.object({
  architecture: types.optional(Architecture$inboundSchema),
  memory: types.optional(types.number()),
  maxDuration: types.optional(
    smartUnion([types.number(), MaxDuration2$inboundSchema]),
  ),
  regions: types.optional(z.array(types.string())),
  functionFailoverRegions: types.optional(z.array(types.string())),
  runtime: types.optional(types.string()),
  includeFiles: types.optional(types.string()),
  excludeFiles: types.optional(types.string()),
  experimentalTriggers: types.optional(
    z.array(z.union([
      z.lazy(() => ExperimentalTriggers1$inboundSchema),
      z.lazy(() =>
        ExperimentalTriggers2$inboundSchema
      ),
    ])),
  ),
  supportsCancellation: types.optional(types.boolean()),
});

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

/** @internal */
export const Routes3$inboundSchema: z.ZodType<Routes3, z.ZodTypeDef, unknown> =
  z.object({
    src: types.string(),
    continue: types.boolean(),
    middleware: types.number(),
  });

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

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

/** @internal */
export const Routes2$inboundSchema: z.ZodType<Routes2, z.ZodTypeDef, unknown> =
  z.object({
    handle: Handle$inboundSchema,
    src: types.optional(types.string()),
    dest: types.optional(types.string()),
    status: types.optional(types.number()),
  });

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

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

/** @internal */
export const ValueEq$inboundSchema: z.ZodType<ValueEq, z.ZodTypeDef, unknown> =
  smartUnion([types.string(), types.number()]);

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

/** @internal */
export const CreateDeploymentValue2$inboundSchema: z.ZodType<
  CreateDeploymentValue2,
  z.ZodTypeDef,
  unknown
> = z.object({
  eq: types.optional(smartUnion([types.string(), types.number()])),
  neq: types.optional(types.string()),
  inc: types.optional(z.array(types.string())),
  ninc: types.optional(z.array(types.string())),
  pre: types.optional(types.string()),
  suf: types.optional(types.string()),
  re: types.optional(types.string()),
  gt: types.optional(types.number()),
  gte: types.optional(types.number()),
  lt: types.optional(types.number()),
  lte: types.optional(types.number()),
});

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

/** @internal */
export const HasValue$inboundSchema: z.ZodType<
  HasValue,
  z.ZodTypeDef,
  unknown
> = smartUnion([
  types.string(),
  z.lazy(() => CreateDeploymentValue2$inboundSchema),
]);

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

/** @internal */
export const Has2$inboundSchema: z.ZodType<Has2, z.ZodTypeDef, unknown> = z
  .object({
    type: CreateDeploymentHasType$inboundSchema,
    key: types.string(),
    value: types.optional(
      smartUnion([
        types.string(),
        z.lazy(() => CreateDeploymentValue2$inboundSchema),
      ]),
    ),
  });

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

/** @internal */
export const Eq$inboundSchema: z.ZodType<Eq, z.ZodTypeDef, unknown> =
  smartUnion([types.string(), types.number()]);

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

/** @internal */
export const CreateDeploymentValueDeploymentsResponse2002$inboundSchema:
  z.ZodType<
    CreateDeploymentValueDeploymentsResponse2002,
    z.ZodTypeDef,
    unknown
  > = z.object({
    eq: types.optional(smartUnion([types.string(), types.number()])),
    neq: types.optional(types.string()),
    inc: types.optional(z.array(types.string())),
    ninc: types.optional(z.array(types.string())),
    pre: types.optional(types.string()),
    suf: types.optional(types.string()),
    re: types.optional(types.string()),
    gt: types.optional(types.number()),
    gte: types.optional(types.number()),
    lt: types.optional(types.number()),
    lte: types.optional(types.number()),
  });

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

/** @internal */
export const CreateDeploymentHasValue$inboundSchema: z.ZodType<
  CreateDeploymentHasValue,
  z.ZodTypeDef,
  unknown
> = smartUnion([
  types.string(),
  z.lazy(() => CreateDeploymentValueDeploymentsResponse2002$inboundSchema),
]);

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

/** @internal */
export const Has1$inboundSchema: z.ZodType<Has1, z.ZodTypeDef, unknown> = z
  .object({
    type: types.literal("host"),
    value: smartUnion([
      types.string(),
      z.lazy(() => CreateDeploymentValueDeploymentsResponse2002$inboundSchema),
    ]),
  });

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

/** @internal */
export const CreateDeploymentRoutesHas$inboundSchema: z.ZodType<
  CreateDeploymentRoutesHas,
  z.ZodTypeDef,
  unknown
> = z.union([
  z.lazy(() => Has1$inboundSchema),
  z.lazy(() => Has2$inboundSchema).and(z.object({ type: z.literal("cookie") })),
  z.lazy(() => Has2$inboundSchema).and(z.object({ type: z.literal("header") })),
  z.lazy(() => Has2$inboundSchema).and(z.object({ type: z.literal("query") })),
]);

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

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

/** @internal */
export const CreateDeploymentValueDeploymentsEq$inboundSchema: z.ZodType<
  CreateDeploymentValueDeploymentsEq,
  z.ZodTypeDef,
  unknown
> = smartUnion([types.string(), types.number()]);

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

/** @internal */
export const CreateDeploymentValueDeploymentsResponse2$inboundSchema: z.ZodType<
  CreateDeploymentValueDeploymentsResponse2,
  z.ZodTypeDef,
  unknown
> = z.object({
  eq: types.optional(smartUnion([types.string(), types.number()])),
  neq: types.optional(types.string()),
  inc: types.optional(z.array(types.string())),
  ninc: types.optional(z.array(types.string())),
  pre: types.optional(types.string()),
  suf: types.optional(types.string()),
  re: types.optional(types.string()),
  gt: types.optional(types.number()),
  gte: types.optional(types.number()),
  lt: types.optional(types.number()),
  lte: types.optional(types.number()),
});

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

/** @internal */
export const CreateDeploymentMissingValue$inboundSchema: z.ZodType<
  CreateDeploymentMissingValue,
  z.ZodTypeDef,
  unknown
> = smartUnion([
  types.string(),
  z.lazy(() => CreateDeploymentValueDeploymentsResponse2$inboundSchema),
]);

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

/** @internal */
export const Missing2$inboundSchema: z.ZodType<
  Missing2,
  z.ZodTypeDef,
  unknown
> = z.object({
  type: CreateDeploymentMissingType$inboundSchema,
  key: types.string(),
  value: types.optional(
    smartUnion([
      types.string(),
      z.lazy(() => CreateDeploymentValueDeploymentsResponse2$inboundSchema),
    ]),
  ),
});

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

/** @internal */
export const CreateDeploymentValueEq$inboundSchema: z.ZodType<
  CreateDeploymentValueEq,
  z.ZodTypeDef,
  unknown
> = smartUnion([types.string(), types.number()]);

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

/** @internal */
export const CreateDeploymentValueDeployments2$inboundSchema: z.ZodType<
  CreateDeploymentValueDeployments2,
  z.ZodTypeDef,
  unknown
> = z.object({
  eq: types.optional(smartUnion([types.string(), types.number()])),
  neq: types.optional(types.string()),
  inc: types.optional(z.array(types.string())),
  ninc: types.optional(z.array(types.string())),
  pre: types.optional(types.string()),
  suf: types.optional(types.string()),
  re: types.optional(types.string()),
  gt: types.optional(types.number()),
  gte: types.optional(types.number()),
  lt: types.optional(types.number()),
  lte: types.optional(types.number()),
});

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