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

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

export type CreateDeploymentValueDeploymentsEq = 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;
};

export type CreateDeploymentHasDeploymentsValue =
  | string
  | CreateDeploymentValueDeployments2;

export type CreateDeploymentHas2 = {
  type: CreateDeploymentHasDeploymentsType;
  key: string;
  value?: string | CreateDeploymentValueDeployments2 | undefined;
};

export type CreateDeploymentValueEq = 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 CreateDeploymentHasValue = string | CreateDeploymentValue2;

export type CreateDeploymentHas1 = {
  type: "host";
  value: string | CreateDeploymentValue2;
};

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

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

export type CreateDeploymentValueDeploymentsResponse200Eq = 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 CreateDeploymentMissingDeploymentsValue =
  | string
  | CreateDeploymentValueDeploymentsResponse2002;

export type CreateDeploymentMissing2 = {
  type: CreateDeploymentMissingDeploymentsType;
  key: string;
  value?: string | CreateDeploymentValueDeploymentsResponse2002 | undefined;
};

export type CreateDeploymentValueDeploymentsResponseEq = 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 CreateDeploymentMissing1 = {
  type: "host";
  value: string | CreateDeploymentValueDeploymentsResponse2;
};

export type CreateDeploymentRoutesMissing =
  | CreateDeploymentMissing1
  | (CreateDeploymentMissing2 & { type: "cookie" })
  | (CreateDeploymentMissing2 & { type: "header" })
  | (CreateDeploymentMissing2 & { type: "query" });

export const CreateDeploymentRoutesAction = {
  Challenge: "challenge",
  Deny: "deny",
} as const;
export type CreateDeploymentRoutesAction = ClosedEnum<
  typeof CreateDeploymentRoutesAction
>;

export type CreateDeploymentRoutesMitigate = {
  action: CreateDeploymentRoutesAction;
};

export const CreateDeploymentTransformsDeploymentsOp = {
  Set: "set",
} as const;
export type CreateDeploymentTransformsDeploymentsOp = ClosedEnum<
  typeof CreateDeploymentTransformsDeploymentsOp
>;

export type CreateDeploymentTransforms2 = {
  type: "request.path";
  op: CreateDeploymentTransformsDeploymentsOp;
  args: string;
  env?: Array<string> | undefined;
};

export const CreateDeploymentTransformsType = {
  RequestHeaders: "request.headers",
  RequestQuery: "request.query",
  ResponseHeaders: "response.headers",
} as const;
export type CreateDeploymentTransformsType = ClosedEnum<
  typeof CreateDeploymentTransformsType
>;

export const CreateDeploymentTransformsOp = {
  Append: "append",
  Delete: "delete",
  Set: "set",
} as const;
export type CreateDeploymentTransformsOp = ClosedEnum<
  typeof CreateDeploymentTransformsOp
>;

export type CreateDeploymentKeyEq = string | number;

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

export type CreateDeploymentTransformsKey = string | CreateDeploymentKey2;

export type CreateDeploymentTransformsTarget = {
  key: string | CreateDeploymentKey2;
};

export type CreateDeploymentTransformsArgs = string | Array<string>;

export type CreateDeploymentTransforms1 = {
  type: CreateDeploymentTransformsType;
  op: CreateDeploymentTransformsOp;
  target: CreateDeploymentTransformsTarget;
  args?: string | Array<string> | undefined;
  env?: Array<string> | undefined;
};

export type CreateDeploymentRoutesTransforms =
  | (CreateDeploymentTransforms1 & { type: "request.headers" })
  | (CreateDeploymentTransforms1 & { type: "request.query" })
  | (CreateDeploymentTransforms1 & { type: "response.headers" })
  | CreateDeploymentTransforms2;

export type RoutesLocale = {
  redirect?: { [k: string]: string } | undefined;
  cookie?: string | undefined;
};

/**
 * Optional explicit format marker. The destination is identified by the presence of `service`, so `type` is no longer required.
 */
export const CreateDeploymentDestinationType = {
  Service: "service",
} as const;
/**
 * Optional explicit format marker. The destination is identified by the presence of `service`, so `type` is no longer required.
 */
export type CreateDeploymentDestinationType = ClosedEnum<
  typeof CreateDeploymentDestinationType
>;

export type CreateDeploymentDestination2 = {
  /**
   * Optional explicit format marker. The destination is identified by the presence of `service`, so `type` is no longer required.
   */
  type?: CreateDeploymentDestinationType | undefined;
  service: string;
  /**
   * Routing-only path used to select a route inside the target service.
   */
  path?: string | undefined;
};

export type CreateDeploymentRoutesDestination =
  | CreateDeploymentDestination2
  | string;

export type CreateDeploymentRoutes1 = {
  src: string;
  dest?: string | undefined;
  headers?: { [k: string]: string } | undefined;
  methods?: Array<string> | undefined;
  continue?: boolean | undefined;
  override?: boolean | undefined;
  caseSensitive?: boolean | undefined;
  check?: boolean | undefined;
  important?: boolean | undefined;
  status?: number | undefined;
  has?:
    | Array<
      | CreateDeploymentHas1
      | (CreateDeploymentHas2 & { type: "cookie" })
      | (CreateDeploymentHas2 & { type: "header" })
      | (CreateDeploymentHas2 & { type: "query" })
    >
    | undefined;
  missing?:
    | Array<
      | CreateDeploymentMissing1
      | (CreateDeploymentMissing2 & { type: "cookie" })
      | (CreateDeploymentMissing2 & { type: "header" })
      | (CreateDeploymentMissing2 & { type: "query" })
    >
    | undefined;
  mitigate?: CreateDeploymentRoutesMitigate | undefined;
  transforms?:
    | Array<
      | (CreateDeploymentTransforms1 & { type: "request.headers" })
      | (CreateDeploymentTransforms1 & { type: "request.query" })
      | (CreateDeploymentTransforms1 & { type: "response.headers" })
      | CreateDeploymentTransforms2
    >
    | undefined;
  env?: Array<string> | undefined;
  locale?: RoutesLocale | undefined;
  /**
   * Aliases for `src`, `dest`, and `status`. These provide consistency with the `rewrites`, `redirects`, and `headers` fields which use `source`, `destination`, and `statusCode`. During normalization, the string forms are converted to their canonical forms (`src`, `dest`, `status`) and stripped from the route object. `destination` may also be a service-targeted object, in which case routing is delegated into the named service's internal route table and the object is preserved as-is (not folded into `dest`).
   */
  source?: string | undefined;
  destination?: CreateDeploymentDestination2 | string | undefined;
  statusCode?: number | undefined;
  /**
   * A middleware key within the `output` key under the build result. Overrides a `middleware` definition.
   */
  middlewarePath?: string | undefined;
  /**
   * The original middleware matchers.
   */
  middlewareRawSrc?: Array<string> | undefined;
  /**
   * A middleware index in the `middleware` key under the build result
   */
  middleware?: number | undefined;
  respectOriginCacheControl?: boolean | undefined;
};

export type ResponseBodyRoutes =
  | CreateDeploymentRoutes3
  | CreateDeploymentRoutes1
  | CreateDeploymentRoutes2;

export type CreateDeploymentServicesDeploymentsIncludeFiles =
  | string
  | Array<string>;

export type CreateDeploymentServicesDeploymentsExcludeFiles =
  | string
  | Array<string>;

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

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

export type CreateDeploymentServicesDeploymentsMaxDuration =
  | number
  | CreateDeploymentMaxDurationDeploymentsResponse2;

export const CreateDeploymentServicesDeploymentsMode = {
  Strict: "strict",
} as const;
export type CreateDeploymentServicesDeploymentsMode = ClosedEnum<
  typeof CreateDeploymentServicesDeploymentsMode
>;

export type CreateDeploymentServicesDeploymentsAffinity = {
  mode: CreateDeploymentServicesDeploymentsMode;
};

export type CreateDeploymentExperimentalTriggersDeploymentsResponse3 = {
  /**
   * Event type - must be "schedule/v1beta" (REQUIRED)
   */
  type: "schedule/v1beta";
};

/**
 * 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 CreateDeploymentExperimentalTriggersDeploymentsResponse2 = {
  /**
   * 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 CreateDeploymentExperimentalTriggersDeploymentsResponse1 = {
  /**
   * 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 CreateDeploymentServicesDeploymentsExperimentalTriggers =
  | CreateDeploymentExperimentalTriggersDeploymentsResponse1
  | CreateDeploymentExperimentalTriggersDeploymentsResponse2
  | CreateDeploymentExperimentalTriggersDeploymentsResponse3;

export type CreateDeploymentServicesDeploymentsFunctions = {
  architecture?: CreateDeploymentServicesDeploymentsArchitecture | undefined;
  memory?: number | undefined;
  maxDuration?:
    | number
    | CreateDeploymentMaxDurationDeploymentsResponse2
    | undefined;
  affinity?: CreateDeploymentServicesDeploymentsAffinity | undefined;
  maxConcurrency?: number | undefined;
  regions?: Array<string> | undefined;
  functionFailoverRegions?: Array<string> | undefined;
  runtime?: string | undefined;
  includeFiles?: string | undefined;
  excludeFiles?: string | undefined;
  experimentalTriggers?:
    | Array<
      | CreateDeploymentExperimentalTriggersDeploymentsResponse1
      | CreateDeploymentExperimentalTriggersDeploymentsResponse2
      | CreateDeploymentExperimentalTriggersDeploymentsResponse3
    >
    | undefined;
  supportsCancellation?: boolean | undefined;
};

export type CreateDeploymentServicesDeploymentsProjectSettings = {
  framework?: string | null | undefined;
  devCommand?: string | null | undefined;
  installCommand?: string | null | undefined;
  buildCommand?: string | null | undefined;
  outputDirectory?: string | null | undefined;
  rootDirectory?: string | null | undefined;
  nodeVersion?: string | undefined;
  monorepoManager?: string | null | undefined;
  createdAt?: number | undefined;
  autoExposeSystemEnvs?: boolean | undefined;
  sourceFilesOutsideRootDirectory?: boolean | undefined;
  directoryListing?: boolean | undefined;
  gitForkProtection?: boolean | undefined;
  commandForIgnoringBuildStep?: string | null | undefined;
};

/**
 * Enforced runtime for explicitly configured Routing Middleware.
 */
export const CreateDeploymentServicesDeploymentsMiddlewareRuntime = {
  Nodejs: "nodejs",
} as const;
/**
 * Enforced runtime for explicitly configured Routing Middleware.
 */
export type CreateDeploymentServicesDeploymentsMiddlewareRuntime = ClosedEnum<
  typeof CreateDeploymentServicesDeploymentsMiddlewareRuntime
>;

export type CreateDeploymentServicesDeploymentsMiddlewareMatcher =
  | string
  | Array<string>;

export type CreateDeploymentServicesDeploymentsConfig = {
  bunVersion?: string | undefined;
  maxLambdaSize?: string | undefined;
  includeFiles?: string | Array<string> | undefined;
  excludeFiles?: string | Array<string> | undefined;
  bundle?: boolean | undefined;
  ldsflags?: string | undefined;
  helpers?: boolean | undefined;
  rust?: string | undefined;
  debug?: boolean | undefined;
  zeroConfig?: boolean | undefined;
  import?: { [k: string]: string } | undefined;
  functions?:
    | { [k: string]: CreateDeploymentServicesDeploymentsFunctions }
    | undefined;
  projectSettings?:
    | CreateDeploymentServicesDeploymentsProjectSettings
    | undefined;
  outputDirectory?: string | undefined;
  installCommand?: string | undefined;
  buildCommand?: string | undefined;
  devCommand?: string | undefined;
  framework?: string | null | undefined;
  nodeVersion?: string | undefined;
  middleware?: boolean | undefined;
  /**
   * Enforced runtime for explicitly configured Routing Middleware.
   */
  middlewareRuntime?:
    | CreateDeploymentServicesDeploymentsMiddlewareRuntime
    | undefined;
  middlewareMatcher?: string | Array<string> | undefined;
  /**
   * Owning service name; scopes per-function config such as the v2beta consumer.
   */
  serviceName?: string | undefined;
};

/**
 * Builder selected by the resolver.
 */
export type CreateDeploymentServicesDeploymentsBuilder = {
  use: string;
  src?: string | undefined;
  config?: CreateDeploymentServicesDeploymentsConfig | undefined;
};

/**
 * If present, must be `"service"` for Service-to-Service HTTP bindings.
 */
export const CreateDeploymentServicesDeploymentsResponseType = {
  Service: "service",
} as const;
/**
 * If present, must be `"service"` for Service-to-Service HTTP bindings.
 */
export type CreateDeploymentServicesDeploymentsResponseType = ClosedEnum<
  typeof CreateDeploymentServicesDeploymentsResponseType
>;

/**
 * Generated value shape, must be `"url"`.
 */
export const ServicesFormat = {
  Url: "url",
} as const;
/**
 * Generated value shape, must be `"url"`.
 */
export type ServicesFormat = ClosedEnum<typeof ServicesFormat>;

/**
 * Caller-side bindings to other services.
 */
export type ServicesBindings = {
  /**
   * If present, must be `"service"` for Service-to-Service HTTP bindings.
   */
  type?: CreateDeploymentServicesDeploymentsResponseType | undefined;
  /**
   * Target service name from `services`.
   */
  service: string;
  /**
   * Generated value shape, must be `"url"`.
   */
  format: ServicesFormat;
  /**
   * Environment variable name that will store the generated value
   */
  env: string;
};

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

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

export type CreateDeploymentServicesMaxDuration =
  | number
  | CreateDeploymentMaxDurationDeployments2;

export const CreateDeploymentServicesMode = {
  Strict: "strict",
} as const;
export type CreateDeploymentServicesMode = ClosedEnum<
  typeof CreateDeploymentServicesMode
>;

export type CreateDeploymentServicesAffinity = {
  mode: CreateDeploymentServicesMode;
};

export type CreateDeploymentExperimentalTriggersDeployments3 = {
  /**
   * Event type - must be "schedule/v1beta" (REQUIRED)
   */
  type: "schedule/v1beta";
};

/**
 * 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 CreateDeploymentExperimentalTriggersDeployments2 = {
  /**
   * 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 CreateDeploymentExperimentalTriggersDeployments1 = {
  /**
   * 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 CreateDeploymentServicesExperimentalTriggers =
  | CreateDeploymentExperimentalTriggersDeployments1
  | CreateDeploymentExperimentalTriggersDeployments2
  | CreateDeploymentExperimentalTriggersDeployments3;

/**
 * Function configuration scoped to this service.
 */
export type CreateDeploymentServicesFunctions = {
  architecture?: CreateDeploymentServicesArchitecture | undefined;
  memory?: number | undefined;
  maxDuration?: number | CreateDeploymentMaxDurationDeployments2 | undefined;
  affinity?: CreateDeploymentServicesAffinity | undefined;
  maxConcurrency?: number | undefined;
  regions?: Array<string> | undefined;
  functionFailoverRegions?: Array<string> | undefined;
  runtime?: string | undefined;
  includeFiles?: string | undefined;
  excludeFiles?: string | undefined;
  experimentalTriggers?:
    | Array<
      | CreateDeploymentExperimentalTriggersDeployments1
      | CreateDeploymentExperimentalTriggersDeployments2
      | CreateDeploymentExperimentalTriggersDeployments3
    >
    | undefined;
  supportsCancellation?: boolean | undefined;
};

export type CreateDeploymentServicesDeploymentsHeaders = {
  key: string;
  value: string;
};

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

export type CreateDeploymentValueDeploymentsResponse200ApplicationJSONResponseBodyEq =
  | string
  | number;

export type CreateDeploymentValueDeploymentsResponse200ApplicationJSONResponseBody2 =
  {
    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 CreateDeploymentHasDeploymentsResponse200Value =
  | string
  | CreateDeploymentValueDeploymentsResponse200ApplicationJSONResponseBody2;

export type CreateDeploymentHasDeployments2 = {
  type: CreateDeploymentHasDeploymentsResponse200Type;
  key: string;
  value?:
    | string
    | CreateDeploymentValueDeploymentsResponse200ApplicationJSONResponseBody2
    | undefined;
};

export type CreateDeploymentValueDeploymentsResponse200ApplicationJSONEq =
  | string
  | number;

export type CreateDeploymentValueDeploymentsResponse200ApplicationJson2 = {
  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 CreateDeploymentHasDeploymentsResponseValue =
  | string
  | CreateDeploymentValueDeploymentsResponse200ApplicationJson2;

export type CreateDeploymentHasDeployments1 = {
  type: "host";
  value: string | CreateDeploymentValueDeploymentsResponse200ApplicationJson2;
};

export type CreateDeploymentServicesHas =
  | CreateDeploymentHasDeployments1
  | (CreateDeploymentHasDeployments2 & { type: "cookie" })
  | (CreateDeploymentHasDeployments2 & { type: "header" })
  | (CreateDeploymentHasDeployments2 & { type: "query" });

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

export type CreateDeploymentValueDeploymentsResponse200ApplicationJSONResponseBody2ServicesEq =
  | string
  | number;

export type CreateDeploymentValueDeploymentsResponse200ApplicationJSONResponseBody2Services2 =
  {
    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 CreateDeploymentMissingDeploymentsResponse200Value =
  | string
  | CreateDeploymentValueDeploymentsResponse200ApplicationJSONResponseBody2Services2;

export type CreateDeploymentMissingDeployments2 = {
  type: CreateDeploymentMissingDeploymentsResponse200Type;
  key: string;
  value?:
    | string
    | CreateDeploymentValueDeploymentsResponse200ApplicationJSONResponseBody2Services2
    | undefined;
};

export type CreateDeploymentValueDeploymentsResponse200ApplicationJSONResponseBody2Eq =
  | string
  | number;

export type CreateDeploymentValueDeploymentsResponse200ApplicationJSONResponseBody22 =
  {
    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 CreateDeploymentMissingDeploymentsResponseValue =
  | string
  | CreateDeploymentValueDeploymentsResponse200ApplicationJSONResponseBody22;

export type CreateDeploymentMissingDeployments1 = {
  type: "host";
  value:
    | string
    | CreateDeploymentValueDeploymentsResponse200ApplicationJSONResponseBody22;
};

export type CreateDeploymentServicesMissing =
  | CreateDeploymentMissingDeployments1
  | (CreateDeploymentMissingDeployments2 & { type: "cookie" })
  | (CreateDeploymentMissingDeployments2 & { type: "header" })
  | (CreateDeploymentMissingDeployments2 & { type: "query" });

export type CreateDeploymentServicesHeaders = {
  source: string;
  headers: Array<CreateDeploymentServicesDeploymentsHeaders>;
  has?:
    | Array<
      | CreateDeploymentHasDeployments1
      | (CreateDeploymentHasDeployments2 & { type: "cookie" })
      | (CreateDeploymentHasDeployments2 & { type: "header" })
      | (CreateDeploymentHasDeployments2 & { type: "query" })
    >
    | undefined;
  missing?:
    | Array<
      | CreateDeploymentMissingDeployments1
      | (CreateDeploymentMissingDeployments2 & { type: "cookie" })
      | (CreateDeploymentMissingDeployments2 & { type: "header" })
      | (CreateDeploymentMissingDeployments2 & { type: "query" })
    >
    | undefined;
};

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

export type CreateDeploymentValueDeploymentsResponse200ApplicationJSONResponseBody2Services2RedirectsEq =
  | string
  | number;

export type CreateDeploymentValueDeploymentsResponse200ApplicationJSONResponseBody2Services2Redirects2 =
  {
    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 CreateDeploymentHasDeploymentsResponse200ApplicationJSONResponseBodyValue =
  | string
  | CreateDeploymentValueDeploymentsResponse200ApplicationJSONResponseBody2Services2Redirects2;

export type CreateDeploymentHasDeploymentsResponse2 = {
  type:
    CreateDeploymentHasDeploymentsResponse200ApplicationJSONResponseBodyType;
  key: string;
  value?:
    | string
    | CreateDeploymentValueDeploymentsResponse200ApplicationJSONResponseBody2Services2Redirects2
    | undefined;
};

export type CreateDeploymentValueDeploymentsResponse200ApplicationJSONResponseBody2Services2Eq =
  | string
  | number;

export type CreateDeploymentValueDeploymentsResponse200ApplicationJSONResponseBody2Services22 =
  {
    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 CreateDeploymentHasDeploymentsResponse200ApplicationJSONValue =
  | string
  | CreateDeploymentValueDeploymentsResponse200ApplicationJSONResponseBody2Services22;

export type CreateDeploymentHasDeploymentsResponse1 = {
  type: "host";
  value:
    | string
    | CreateDeploymentValueDeploymentsResponse200ApplicationJSONResponseBody2Services22;
};

export type CreateDeploymentServicesDeploymentsHas =
  | CreateDeploymentHasDeploymentsResponse1
  | (CreateDeploymentHasDeploymentsResponse2 & { type: "cookie" })
  | (CreateDeploymentHasDeploymentsResponse2 & { type: "header" })
  | (CreateDeploymentHasDeploymentsResponse2 & { type: "query" });

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

export type CreateDeploymentValueDeploymentsResponse200ApplicationJSONResponseBody2Services2RedirectsMissing2Eq =
  | string
  | number;

export type CreateDeploymentValueDeploymentsResponse200ApplicationJSONResponseBody2Services2RedirectsMissing22 =
  {
    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 CreateDeploymentMissingDeploymentsResponse200ApplicationJSONResponseBodyValue =
  | string
  | CreateDeploymentValueDeploymentsResponse200ApplicationJSONResponseBody2Services2RedirectsMissing22;

export type CreateDeploymentMissingDeploymentsResponse2 = {
  type:
    CreateDeploymentMissingDeploymentsResponse200ApplicationJSONResponseBodyType;
  key: string;
  value?:
    | string
    | CreateDeploymentValueDeploymentsResponse200ApplicationJSONResponseBody2Services2RedirectsMissing22
    | undefined;
};

export type CreateDeploymentValueDeploymentsResponse200ApplicationJSONResponseBody2Services2RedirectsMissingEq =
  | string
  | number;

export type CreateDeploymentValueDeploymentsResponse200ApplicationJSONResponseBody2Services2RedirectsMissing2 =
  {
    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 CreateDeploymentMissingDeploymentsResponse200ApplicationJSONValue =
  | string
  | CreateDeploymentValueDeploymentsResponse200ApplicationJSONResponseBody2Services2RedirectsMissing2;

export type CreateDeploymentMissingDeploymentsResponse1 = {
  type: "host";
  value:
    | string
    | CreateDeploymentValueDeploymentsResponse200ApplicationJSONResponseBody2Services2RedirectsMissing2;
};

export type CreateDeploymentServicesDeploymentsMissing =
  | CreateDeploymentMissingDeploymentsResponse1
  | (CreateDeploymentMissingDeploymentsResponse2 & { type: "cookie" })
  | (CreateDeploymentMissingDeploymentsResponse2 & { type: "header" })
  | (CreateDeploymentMissingDeploymentsResponse2 & { type: "query" });

export type CreateDeploymentServicesRedirects = {
  source: string;
  destination: string;
  permanent?: boolean | undefined;
  statusCode?: number | undefined;
  has?:
    | Array<
      | CreateDeploymentHasDeploymentsResponse1
      | (CreateDeploymentHasDeploymentsResponse2 & { type: "cookie" })
      | (CreateDeploymentHasDeploymentsResponse2 & { type: "header" })
      | (CreateDeploymentHasDeploymentsResponse2 & { type: "query" })
    >
    | undefined;
  missing?:
    | Array<
      | CreateDeploymentMissingDeploymentsResponse1
      | (CreateDeploymentMissingDeploymentsResponse2 & { type: "cookie" })
      | (CreateDeploymentMissingDeploymentsResponse2 & { type: "header" })
      | (CreateDeploymentMissingDeploymentsResponse2 & { type: "query" })
    >
    | undefined;
  env?: Array<string> | undefined;
};

/**
 * Optional explicit format marker. The destination is identified by the presence of `service`, so `type` is no longer required.
 */
export const CreateDeploymentDestinationDeploymentsType = {
  Service: "service",
} as const;
/**
 * Optional explicit format marker. The destination is identified by the presence of `service`, so `type` is no longer required.
 */
export type CreateDeploymentDestinationDeploymentsType = ClosedEnum<
  typeof CreateDeploymentDestinationDeploymentsType
>;

export type CreateDeploymentDestinationDeployments2 = {
  /**
   * Optional explicit format marker. The destination is identified by the presence of `service`, so `type` is no longer required.
   */
  type?: CreateDeploymentDestinationDeploymentsType | undefined;
  service: string;
  /**
   * Routing-only path used to select a route inside the target service.
   */
  path?: string | undefined;
};

export type CreateDeploymentServicesDestination =
  | CreateDeploymentDestinationDeployments2
  | string;

export const CreateDeploymentServicesDeploymentsResponse200Type = {
  RequestPath: "request.path",
} as const;
export type CreateDeploymentServicesDeploymentsResponse200Type = ClosedEnum<
  typeof CreateDeploymentServicesDeploymentsResponse200Type
>;

export const CreateDeploymentServicesOp = {
  Set: "set",
} as const;
export type CreateDeploymentServicesOp = ClosedEnum<
  typeof CreateDeploymentServicesOp
>;

export type CreateDeploymentServicesTransforms = {
  type: CreateDeploymentServicesDeploymentsResponse200Type;
  op: CreateDeploymentServicesOp;
  args: string;
  env?: Array<string> | undefined;
};

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

export type CreateDeploymentValueDeploymentsResponse200ApplicationJSONResponseBody2Services2RewritesHasEq =
  | string
  | number;

export type CreateDeploymentValueDeploymentsResponse200ApplicationJSONResponseBody2Services2RewritesHas2 =
  {
    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 CreateDeploymentHasDeploymentsResponse200ApplicationJSONResponseBody2ServicesValue =
  | string
  | CreateDeploymentValueDeploymentsResponse200ApplicationJSONResponseBody2Services2RewritesHas2;

export type CreateDeploymentHasDeploymentsResponse2002 = {
  type:
    CreateDeploymentHasDeploymentsResponse200ApplicationJSONResponseBody2ServicesType;
  key: string;
  value?:
    | string
    | CreateDeploymentValueDeploymentsResponse200ApplicationJSONResponseBody2Services2RewritesHas2
    | undefined;
};

export type CreateDeploymentValueDeploymentsResponse200ApplicationJSONResponseBody2Services2RewritesEq =
  | string
  | number;

export type CreateDeploymentValueDeploymentsResponse200ApplicationJSONResponseBody2Services2Rewrites2 =
  {
    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 CreateDeploymentHasDeploymentsResponse200ApplicationJSONResponseBody2Value =
  | string
  | CreateDeploymentValueDeploymentsResponse200ApplicationJSONResponseBody2Services2Rewrites2;

export type CreateDeploymentHasDeploymentsResponse2001 = {
  type: "host";
  value:
    | string
    | CreateDeploymentValueDeploymentsResponse200ApplicationJSONResponseBody2Services2Rewrites2;
};

export type CreateDeploymentServicesDeploymentsResponseHas =
  | CreateDeploymentHasDeploymentsResponse2001
  | (CreateDeploymentHasDeploymentsResponse2002 & { type: "cookie" })
  | (CreateDeploymentHasDeploymentsResponse2002 & { type: "header" })
  | (CreateDeploymentHasDeploymentsResponse2002 & { type: "query" });

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

export type CreateDeploymentValueDeploymentsResponse200ApplicationJSONResponseBody2Services2RewritesMissing2Eq =
  | string
  | number;

export type CreateDeploymentValueDeploymentsResponse200ApplicationJSONResponseBody2Services2RewritesMissing22 =
  {
    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 CreateDeploymentMissingDeploymentsResponse200ApplicationJSONResponseBody2ServicesValue =
  | string
  | CreateDeploymentValueDeploymentsResponse200ApplicationJSONResponseBody2Services2RewritesMissing22;

export type CreateDeploymentMissingDeploymentsResponse2002 = {
  type:
    CreateDeploymentMissingDeploymentsResponse200ApplicationJSONResponseBody2ServicesType;
  key: string;
  value?:
    | string
    | CreateDeploymentValueDeploymentsResponse200ApplicationJSONResponseBody2Services2RewritesMissing22
    | undefined;
};

export type CreateDeploymentValueDeploymentsResponse200ApplicationJSONResponseBody2Services2RewritesMissingEq =
  | string
  | number;

export type CreateDeploymentValueDeploymentsResponse200ApplicationJSONResponseBody2Services2RewritesMissing2 =
  {
    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 CreateDeploymentMissingDeploymentsResponse200ApplicationJSONResponseBody2Value =
  | string
  | CreateDeploymentValueDeploymentsResponse200ApplicationJSONResponseBody2Services2RewritesMissing2;

export type CreateDeploymentMissingDeploymentsResponse2001 = {
  type: "host";
  value:
    | string
    | CreateDeploymentValueDeploymentsResponse200ApplicationJSONResponseBody2Services2RewritesMissing2;
};

export type CreateDeploymentServicesDeploymentsResponseMissing =
  | CreateDeploymentMissingDeploymentsResponse2001
  | (CreateDeploymentMissingDeploymentsResponse2002 & { type: "cookie" })
  | (CreateDeploymentMissingDeploymentsResponse2002 & { type: "header" })
  | (CreateDeploymentMissingDeploymentsResponse2002 & { type: "query" });

export type ServicesRewrites = {
  source: string;
  destination: CreateDeploymentDestinationDeployments2 | string;
  transforms?: Array<CreateDeploymentServicesTransforms> | undefined;
  has?:
    | Array<
      | CreateDeploymentHasDeploymentsResponse2001
      | (CreateDeploymentHasDeploymentsResponse2002 & { type: "cookie" })
      | (CreateDeploymentHasDeploymentsResponse2002 & { type: "header" })
      | (CreateDeploymentHasDeploymentsResponse2002 & { type: "query" })
    >
    | undefined;
  missing?:
    | Array<
      | CreateDeploymentMissingDeploymentsResponse2001
      | (CreateDeploymentMissingDeploymentsResponse2002 & { type: "cookie" })
      | (CreateDeploymentMissingDeploymentsResponse2002 & { type: "header" })
      | (CreateDeploymentMissingDeploymentsResponse2002 & { type: "query" })
    >
    | undefined;
  statusCode?: number | undefined;
  env?: Array<string> | undefined;
  respectOriginCacheControl?: boolean | undefined;
};

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

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

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

export type CreateDeploymentValueDeploymentsResponse200ApplicationJSONResponseBody2Services2Routes1Eq =
  | string
  | number;

export type CreateDeploymentValueDeploymentsResponse200ApplicationJSONResponseBody2Services2Routes12 =
  {
    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 CreateDeploymentHasDeploymentsResponse200ApplicationJSONResponseBody2Services2RoutesValue =
  | string
  | CreateDeploymentValueDeploymentsResponse200ApplicationJSONResponseBody2Services2Routes12;

export type CreateDeploymentHasDeploymentsResponse200ApplicationJson2 = {
  type:
    CreateDeploymentHasDeploymentsResponse200ApplicationJSONResponseBody2Services2RoutesType;
  key: string;
  value?:
    | string
    | CreateDeploymentValueDeploymentsResponse200ApplicationJSONResponseBody2Services2Routes12
    | undefined;
};

export type CreateDeploymentValueDeploymentsResponse200ApplicationJSONResponseBody2Services2RoutesEq =
  | string
  | number;

export type CreateDeploymentValueDeploymentsResponse200ApplicationJSONResponseBody2Services2Routes2 =
  {
    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 CreateDeploymentHasDeploymentsResponse200ApplicationJSONResponseBody2Services2Value =
  | string
  | CreateDeploymentValueDeploymentsResponse200ApplicationJSONResponseBody2Services2Routes2;

export type CreateDeploymentHasDeploymentsResponse200ApplicationJson1 = {
  type: "host";
  value:
    | string
    | CreateDeploymentValueDeploymentsResponse200ApplicationJSONResponseBody2Services2Routes2;
};

export type CreateDeploymentRoutesDeploymentsHas =
  | CreateDeploymentHasDeploymentsResponse200ApplicationJson1
  | (CreateDeploymentHasDeploymentsResponse200ApplicationJson2 & {
    type: "cookie";
  })
  | (CreateDeploymentHasDeploymentsResponse200ApplicationJson2 & {
    type: "header";
  })
  | (CreateDeploymentHasDeploymentsResponse200ApplicationJson2 & {
    type: "query";
  });

/** @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 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`,
  );
}

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

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

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

export function createDeploymentHas2FromJSON(
  jsonString: string,
): SafeParseResult<CreateDeploymentHas2, SDKValidationError> {
  return safeParse(
    jsonString,
    (x) => CreateDeploymentHas2$inboundSchema.parse(JSON.parse(x)),
    `Failed to parse 'CreateDeploymentHas2' 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 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 CreateDeploymentHasValue$inboundSchema: z.ZodType<
  CreateDeploymentHasValue,
  z.ZodTypeDef,
  unknown
> = smartUnion([
  types.string(),
  z.lazy(() => CreateDeploymentValue2$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 CreateDeploymentHas1$inboundSchema: z.ZodType<
  CreateDeploymentHas1,
  z.ZodTypeDef,
  unknown
> = z.object({
  type: types.literal("host"),
  value: smartUnion([
    types.string(),
    z.lazy(() => CreateDeploymentValue2$inboundSchema),
  ]),
});

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

/** @internal */
export const CreateDeploymentRoutesHas$inboundSchema: z.ZodType<
  CreateDeploymentRoutesHas,
  z.ZodTypeDef,
  unknown
> = z.union([
  z.lazy(() => CreateDeploymentHas1$inboundSchema),
  z.lazy(() => CreateDeploymentHas2$inboundSchema).and(
    z.object({ type: z.literal("cookie") }),
  ),
  z.lazy(() => CreateDeploymentHas2$inboundSchema).and(
    z.object({ type: z.literal("header") }),
  ),
  z.lazy(() => CreateDeploymentHas2$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 CreateDeploymentMissingDeploymentsType$inboundSchema:
  z.ZodNativeEnum<typeof CreateDeploymentMissingDeploymentsType> = z.nativeEnum(
    CreateDeploymentMissingDeploymentsType,
  );

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

export function createDeploymentValueDeploymentsResponse200EqFromJSON(
  jsonString: string,
): SafeParseResult<
  CreateDeploymentValueDeploymentsResponse200Eq,
  SDKValidationError
> {
  return safeParse(
    jsonString,
    (x) =>
      CreateDeploymentValueDeploymentsResponse200Eq$inboundSchema.parse(
        JSON.parse(x),
      ),
    `Failed to parse 'CreateDeploymentValueDeploymentsResponse200Eq' 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 CreateDeploymentMissingDeploymentsValue$inboundSchema: z.ZodType<
  CreateDeploymentMissingDeploymentsValue,
  z.ZodTypeDef,
  unknown
> = smartUnion([
  types.string(),
  z.lazy(() => CreateDeploymentValueDeploymentsResponse2002$inboundSchema),
]);

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

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

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

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

export function createDeploymentValueDeploymentsResponseEqFromJSON(
  jsonString: string,
): SafeParseResult<
  CreateDeploymentValueDeploymentsResponseEq,
  SDKValidationError
> {
  return safeParse(
    jsonString,
    (x) =>
      CreateDeploymentValueDeploymentsResponseEq$inboundSchema.parse(
        JSON.parse(x),
      ),
    `Failed to parse 'CreateDeploymentValueDeploymentsResponseEq' 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 CreateDeploymentMissing1$inboundSchema: z.ZodType<
  CreateDeploymentMissing1,
  z.ZodTypeDef,
  unknown
> = z.object({
  type: types.literal("host"),
  value: smartUnion([
    types.string(),
    z.lazy(() => CreateDeploymentValueDeploymentsResponse2$inboundSchema),
  ]),
});

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

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

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

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

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

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

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

/** @internal */
export const CreateDeploymentTransforms2$inboundSchema: z.ZodType<
  CreateDeploymentTransforms2,
  z.ZodTypeDef,
  unknown
> = z.object({
  type: types.literal("request.path"),
  op: CreateDeploymentTransformsDeploymentsOp$inboundSchema,
  args: types.string(),
  env: types.optional(z.array(types.string())),
});

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

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

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

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

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

/** @internal */
export const CreateDeploymentKey2$inboundSchema: z.ZodType<
  CreateDeploymentKey2,
  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()),
  gt: types.optional(types.number()),
  gte: types.optional(types.number()),
  lt: types.optional(types.number()),
  lte: types.optional(types.number()),
});

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

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

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

/** @internal */
export const CreateDeploymentTransformsTarget$inboundSchema: z.ZodType<
  CreateDeploymentTransformsTarget,
  z.ZodTypeDef,
  unknown
> = z.object({
  key: smartUnion([
    types.string(),
    z.lazy(() => CreateDeploymentKey2$inboundSchema),
  ]),
});

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

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

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

/** @internal */
export const CreateDeploymentTransforms1$inboundSchema: z.ZodType<
  CreateDeploymentTransforms1,
  z.ZodTypeDef,
  unknown
> = z.object({
  type: CreateDeploymentTransformsType$inboundSchema,
  op: CreateDeploymentTransformsOp$inboundSchema,
  target: z.lazy(() => CreateDeploymentTransformsTarget$inboundSchema),
  args: types.optional(smartUnion([types.string(), z.array(types.string())])),
  env: types.optional(z.array(types.string())),
});

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

/** @internal */
export const CreateDeploymentRoutesTransforms$inboundSchema: z.ZodType<
  CreateDeploymentRoutesTransforms,
  z.ZodTypeDef,
  unknown
> = z.union([
  z.lazy(() => CreateDeploymentTransforms1$inboundSchema).and(
    z.object({ type: z.literal("request.headers") }),
  ),
  z.lazy(() => CreateDeploymentTransforms1$inboundSchema).and(
    z.object({ type: z.literal("request.query") }),
  ),
  z.lazy(() => CreateDeploymentTransforms1$inboundSchema).and(
    z.object({ type: z.literal("response.headers") }),
  ),
  z.lazy(() => CreateDeploymentTransforms2$inboundSchema),
]);

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

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

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

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

/** @internal */
export const CreateDeploymentDestination2$inboundSchema: z.ZodType<
  CreateDeploymentDestination2,
  z.ZodTypeDef,
  unknown
> = z.object({
  type: types.optional(CreateDeploymentDestinationType$inboundSchema),
  service: types.string(),
  path: types.optional(types.string()),
});

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

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

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

/** @internal */
export const CreateDeploymentRoutes1$inboundSchema: z.ZodType<
  CreateDeploymentRoutes1,
  z.ZodTypeDef,
  unknown
> = z.object({
  src: types.string(),
  dest: types.optional(types.string()),
  headers: types.optional(z.record(types.string())),
  methods: types.optional(z.array(types.string())),
  continue: types.optional(types.boolean()),
  override: types.optional(types.boolean()),
  caseSensitive: types.optional(types.boolean()),
  check: types.optional(types.boolean()),
  important: types.optional(types.boolean()),
  status: types.optional(types.number()),
  has: types.optional(
    z.array(z.union([
      z.lazy(() => CreateDeploymentHas1$inboundSchema),
      z.lazy(() =>
        CreateDeploymentHas2$inboundSchema
      ).and(z.object({ type: z.literal("cookie") })),
      z.lazy(() => CreateDeploymentHas2$inboundSchema).and(
        z.object({ type: z.literal("header") }),
      ),
      z.lazy(() => CreateDeploymentHas2$inboundSchema).and(
        z.object({ type: z.literal("query") }),
      ),
    ])),
  ),
  missing: types.optional(
    z.array(z.union([
      z.lazy(() => CreateDeploymentMissing1$inboundSchema),
      z.lazy(() =>
        CreateDeploymentMissing2$inboundSchema
      ).and(z.object({ type: z.literal("cookie") })),
      z.lazy(() => CreateDeploymentMissing2$inboundSchema).and(
        z.object({ type: z.literal("header") }),
      ),
      z.lazy(() => CreateDeploymentMissing2$inboundSchema).and(
        z.object({ type: z.literal("query") }),
      ),
    ])),
  ),
  mitigate: types.optional(
    z.lazy(() => CreateDeploymentRoutesMitigate$inboundSchema),
  ),
  transforms: types.optional(
    z.array(z.union([
      z.lazy(() => CreateDeploymentTransforms1$inboundSchema).and(
        z.object({ type: z.literal("request.headers") }),
      ),
      z.lazy(() => CreateDeploymentTransforms1$inboundSchema).and(
        z.object({ type: z.literal("request.query") }),
      ),
      z.lazy(() => CreateDeploymentTransforms1$inboundSchema).and(
        z.object({ type: z.literal("response.headers") }),
      ),
      z.lazy(() => CreateDeploymentTransforms2$inboundSchema),
    ])),
  ),
  env: types.optional(z.array(types.string())),
  locale: types.optional(z.lazy(() => RoutesLocale$inboundSchema)),
  source: types.optional(types.string()),
  destination: types.optional(
    smartUnion([
      z.lazy(() => CreateDeploymentDestination2$inboundSchema),
      types.string(),
    ]),
  ),
  statusCode: types.optional(types.number()),
  middlewarePath: types.optional(types.string()),
  middlewareRawSrc: types.optional(z.array(types.string())),
  middleware: types.optional(types.number()),
  respectOriginCacheControl: types.optional(types.boolean()),
});

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

/** @internal */
export const ResponseBodyRoutes$inboundSchema: z.ZodType<
  ResponseBodyRoutes,
  z.ZodTypeDef,
  unknown
> = smartUnion([
  CreateDeploymentRoutes3$inboundSchema,
  z.lazy(() => CreateDeploymentRoutes1$inboundSchema),
  CreateDeploymentRoutes2$inboundSchema,
]);

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

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

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

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

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

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

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

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

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

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

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

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

/** @internal */
export const CreateDeploymentExperimentalTriggersDeploymentsResponse3$inboundSchema:
  z.ZodType<
    CreateDeploymentExperimentalTriggersDeploymentsResponse3,
    z.ZodTypeDef,
    unknown
  > = z.object({
    type: types.literal("schedule/v1beta"),
  });

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

/** @internal */
export const CreateDeploymentExperimentalTriggersDeploymentsResponse2$inboundSchema:
  z.ZodType<
    CreateDeploymentExperimentalTriggersDeploymentsResponse2,
    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 createDeploymentExperimentalTriggersDeploymentsResponse2FromJSON(
  jsonString: string,
): SafeParseResult<
  CreateDeploymentExperimentalTriggersDeploymentsResponse2,
  SDKValidationError
> {
  return safeParse(
    jsonString,
    (x) =>
      CreateDeploymentExperimentalTriggersDeploymentsResponse2$inboundSchema
        .parse(JSON.parse(x)),
    `Failed to parse 'CreateDeploymentExperimentalTriggersDeploymentsResponse2' from JSON`,
  );
}

/** @internal */
export const CreateDeploymentExperimentalTriggersDeploymentsResponse1$inboundSchema:
  z.ZodType<
    CreateDeploymentExperimentalTriggersDeploymentsResponse1,
    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 createDeploymentExperimentalTriggersDeploymentsResponse1FromJSON(
  jsonString: string,
): SafeParseResult<
  CreateDeploymentExperimentalTriggersDeploymentsResponse1,
  SDKValidationError
> {
  return safeParse(
    jsonString,
    (x) =>
      CreateDeploymentExperimentalTriggersDeploymentsResponse1$inboundSchema
        .parse(JSON.parse(x)),
    `Failed to parse 'CreateDeploymentExperimentalTriggersDeploymentsResponse1' from JSON`,
  );
}

/** @internal */
export const CreateDeploymentServicesDeploymentsExperimentalTriggers$inboundSchema:
  z.ZodType<
    CreateDeploymentServicesDeploymentsExperimentalTriggers,
    z.ZodTypeDef,
    unknown
  > = z.union([
    z.lazy(() =>
      CreateDeploymentExperimentalTriggersDeploymentsResponse1$inboundSchema
    ),
    z.lazy(() =>
      CreateDeploymentExperimentalTriggersDeploymentsResponse2$inboundSchema
    ),
    z.lazy(() =>
      CreateDeploymentExperimentalTriggersDeploymentsResponse3$inboundSchema
    ),
  ]);

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

/** @internal */
export const CreateDeploymentServicesDeploymentsFunctions$inboundSchema:
  z.ZodType<
    CreateDeploymentServicesDeploymentsFunctions,
    z.ZodTypeDef,
    unknown
  > = z.object({
    architecture: types.optional(
      CreateDeploymentServicesDeploymentsArchitecture$inboundSchema,
    ),
    memory: types.optional(types.number()),
    maxDuration: types.optional(
      smartUnion([
        types.number(),
        CreateDeploymentMaxDurationDeploymentsResponse2$inboundSchema,
      ]),
    ),
    affinity: types.optional(
      z.lazy(() => CreateDeploymentServicesDeploymentsAffinity$inboundSchema),
    ),
    maxConcurrency: types.optional(types.number()),
    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(() =>
          CreateDeploymentExperimentalTriggersDeploymentsResponse1$inboundSchema
        ),
        z.lazy(() =>
          CreateDeploymentExperimentalTriggersDeploymentsResponse2$inboundSchema
        ),
        z.lazy(() =>
          CreateDeploymentExperimentalTriggersDeploymentsResponse3$inboundSchema
        ),
      ])),
    ),
    supportsCancellation: types.optional(types.boolean()),
  });

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

/** @internal */
export const CreateDeploymentServicesDeploymentsProjectSettings$inboundSchema:
  z.ZodType<
    CreateDeploymentServicesDeploymentsProjectSettings,
    z.ZodTypeDef,
    unknown
  > = z.object({
    framework: z.nullable(types.string()).optional(),
    devCommand: z.nullable(types.string()).optional(),
    installCommand: z.nullable(types.string()).optional(),
    buildCommand: z.nullable(types.string()).optional(),
    outputDirectory: z.nullable(types.string()).optional(),
    rootDirectory: z.nullable(types.string()).optional(),
    nodeVersion: types.optional(types.string()),
    monorepoManager: z.nullable(types.string()).optional(),
    createdAt: types.optional(types.number()),
    autoExposeSystemEnvs: types.optional(types.boolean()),
    sourceFilesOutsideRootDirectory: types.optional(types.boolean()),
    directoryListing: types.optional(types.boolean()),
    gitForkProtection: types.optional(types.boolean()),
    commandForIgnoringBuildStep: z.nullable(types.string()).optional(),
  });

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

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

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

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

/** @internal */
export const CreateDeploymentServicesDeploymentsConfig$inboundSchema: z.ZodType<
  CreateDeploymentServicesDeploymentsConfig,
  z.ZodTypeDef,
  unknown
> = z.object({
  bunVersion: types.optional(types.string()),
  maxLambdaSize: types.optional(types.string()),
  includeFiles: types.optional(
    smartUnion([types.string(), z.array(types.string())]),
  ),
  excludeFiles: types.optional(
    smartUnion([types.string(), z.array(types.string())]),
  ),
  bundle: types.optional(types.boolean()),
  ldsflags: types.optional(types.string()),
  helpers: types.optional(types.boolean()),
  rust: types.optional(types.string()),
  debug: types.optional(types.boolean()),
  zeroConfig: types.optional(types.boolean()),
  import: types.optional(z.record(types.string())),
  functions: types.optional(
    z.record(z.lazy(() =>
      CreateDeploymentServicesDeploymentsFunctions$inboundSchema
    )),
  ),
  projectSettings: types.optional(
    z.lazy(() =>
      CreateDeploymentServicesDeploymentsProjectSettings$inboundSchema
    ),
  ),
  outputDirectory: types.optional(types.string()),
  installCommand: types.optional(types.string()),
  buildCommand: types.optional(types.string()),
  devCommand: types.optional(types.string()),
  framework: z.nullable(types.string()).optional(),
  nodeVersion: types.optional(types.string()),
  middleware: types.optional(types.boolean()),
  middlewareRuntime: types.optional(
    CreateDeploymentServicesDeploymentsMiddlewareRuntime$inboundSchema,
  ),
  middlewareMatcher: types.optional(
    smartUnion([types.string(), z.array(types.string())]),
  ),
  serviceName: types.optional(types.string()),
});

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

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

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

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

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

/** @internal */
export const ServicesBindings$inboundSchema: z.ZodType<
  ServicesBindings,
  z.ZodTypeDef,
  unknown
> = z.object({
  type: types.optional(
    CreateDeploymentServicesDeploymentsResponseType$inboundSchema,
  ),
  service: types.string(),
  format: ServicesFormat$inboundSchema,
  env: types.string(),
});

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

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

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

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

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

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

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

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

/** @internal */
export const CreateDeploymentExperimentalTriggersDeployments3$inboundSchema:
  z.ZodType<
    CreateDeploymentExperimentalTriggersDeployments3,
    z.ZodTypeDef,
    unknown
  > = z.object({
    type: types.literal("schedule/v1beta"),
  });

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

/** @internal */
export const CreateDeploymentExperimentalTriggersDeployments2$inboundSchema:
  z.ZodType<
    CreateDeploymentExperimentalTriggersDeployments2,
    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 createDeploymentExperimentalTriggersDeployments2FromJSON(
  jsonString: string,
): SafeParseResult<
  CreateDeploymentExperimentalTriggersDeployments2,
  SDKValidationError
> {
  return safeParse(
    jsonString,
    (x) =>
      CreateDeploymentExperimentalTriggersDeployments2$inboundSchema.parse(
        JSON.parse(x),
      ),
    `Failed to parse 'CreateDeploymentExperimentalTriggersDeployments2' from JSON`,
  );
}

/** @internal */
export const CreateDeploymentExperimentalTriggersDeployments1$inboundSchema:
  z.ZodType<
    CreateDeploymentExperimentalTriggersDeployments1,
    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 createDeploymentExperimentalTriggersDeployments1FromJSON(
  jsonString: string,
): SafeParseResult<
  CreateDeploymentExperimentalTriggersDeployments1,
  SDKValidationError
> {
  return safeParse(
    jsonString,
    (x) =>
      CreateDeploymentExperimentalTriggersDeployments1$inboundSchema.parse(
        JSON.parse(x),
      ),
    `Failed to parse 'CreateDeploymentExperimentalTriggersDeployments1' from JSON`,
  );
}

/** @internal */
export const CreateDeploymentServicesExperimentalTriggers$inboundSchema:
  z.ZodType<
    CreateDeploymentServicesExperimentalTriggers,
    z.ZodTypeDef,
    unknown
  > = z.union([
    z.lazy(() =>
      CreateDeploymentExperimentalTriggersDeployments1$inboundSchema
    ),
    z.lazy(() =>
      CreateDeploymentExperimentalTriggersDeployments2$inboundSchema
    ),
    z.lazy(() =>
      CreateDeploymentExperimentalTriggersDeployments3$inboundSchema
    ),
  ]);

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

/** @internal */
export const CreateDeploymentServicesFunctions$inboundSchema: z.ZodType<
  CreateDeploymentServicesFunctions,
  z.ZodTypeDef,
  unknown
> = z.object({
  architecture: types.optional(
    CreateDeploymentServicesArchitecture$inboundSchema,
  ),
  memory: types.optional(types.number()),
  maxDuration: types.optional(
    smartUnion([
      types.number(),
      CreateDeploymentMaxDurationDeployments2$inboundSchema,
    ]),
  ),
  affinity: types.optional(
    z.lazy(() => CreateDeploymentServicesAffinity$inboundSchema),
  ),
  maxConcurrency: types.optional(types.number()),
  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(() =>
        CreateDeploymentExperimentalTriggersDeployments1$inboundSchema
      ),
      z.lazy(() =>
        CreateDeploymentExperimentalTriggersDeployments2$inboundSchema
      ),
      z.lazy(() =>
        CreateDeploymentExperimentalTriggersDeployments3$inboundSchema
      ),
    ])),
  ),
  supportsCancellation: types.optional(types.boolean()),
});

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

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

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

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

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

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

/** @internal */
export const CreateDeploymentValueDeploymentsResponse200ApplicationJSONResponseBody2$inboundSchema:
  z.ZodType<
    CreateDeploymentValueDeploymentsResponse200ApplicationJSONResponseBody2,
    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 createDeploymentValueDeploymentsResponse200ApplicationJSONResponseBody2FromJSON(
  jsonString: string,
): SafeParseResult<
  CreateDeploymentValueDeploymentsResponse200ApplicationJSONResponseBody2,
  SDKValidationError
> {
  return safeParse(
    jsonString,
    (x) =>
      CreateDeploymentValueDeploymentsResponse200ApplicationJSONResponseBody2$inboundSchema
        .parse(JSON.parse(x)),
    `Failed to parse 'CreateDeploymentValueDeploymentsResponse200ApplicationJSONResponseBody2' from JSON`,
  );
}

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

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

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

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

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

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

/** @internal */
export const CreateDeploymentValueDeploymentsResponse200ApplicationJson2$inboundSchema:
  z.ZodType<
    CreateDeploymentValueDeploymentsResponse200ApplicationJson2,
    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 createDeploymentValueDeploymentsResponse200ApplicationJSON2FromJSON(
  jsonString: string,
): SafeParseResult<
  CreateDeploymentValueDeploymentsResponse200ApplicationJson2,
  SDKValidationError
> {
  return safeParse(
    jsonString,
    (x) =>
      CreateDeploymentValueDeploymentsResponse200ApplicationJson2$inboundSchema
        .parse(JSON.parse(x)),
    `Failed to parse 'CreateDeploymentValueDeploymentsResponse200ApplicationJson2' from JSON`,
  );
}

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

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

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

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

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

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

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

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

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

/** @internal */
export const CreateDeploymentValueDeploymentsResponse200ApplicationJSONResponseBody2Services2$inboundSchema:
  z.ZodType<
    CreateDeploymentValueDeploymentsResponse200ApplicationJSONResponseBody2Services2,
    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 createDeploymentValueDeploymentsResponse200ApplicationJSONResponseBody2Services2FromJSON(
  jsonString: string,
): SafeParseResult<
  CreateDeploymentValueDeploymentsResponse200ApplicationJSONResponseBody2Services2,
  SDKValidationError
> {
  return safeParse(
    jsonString,
    (x) =>
      CreateDeploymentValueDeploymentsResponse200ApplicationJSONResponseBody2Services2$inboundSchema
        .parse(JSON.parse(x)),
    `Failed to parse 'CreateDeploymentValueDeploymentsResponse200ApplicationJSONResponseBody2Services2' from JSON`,
  );
}

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

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

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

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

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

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

/** @internal */
export const CreateDeploymentValueDeploymentsResponse200ApplicationJSONResponseBody22$inboundSchema:
  z.ZodType<
    CreateDeploymentValueDeploymentsResponse200ApplicationJSONResponseBody22,
    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 createDeploymentValueDeploymentsResponse200ApplicationJSONResponseBody22FromJSON(
  jsonString: string,
): SafeParseResult<
  CreateDeploymentValueDeploymentsResponse200ApplicationJSONResponseBody22,
  SDKValidationError
> {
  return safeParse(
    jsonString,
    (x) =>
      CreateDeploymentValueDeploymentsResponse200ApplicationJSONResponseBody22$inboundSchema
        .parse(JSON.parse(x)),
    `Failed to parse 'CreateDeploymentValueDeploymentsResponse200ApplicationJSONResponseBody22' from JSON`,
  );
}

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

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

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

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

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

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

/** @internal */
export const CreateDeploymentServicesHeaders$inboundSchema: z.ZodType<
  CreateDeploymentServicesHeaders,
  z.ZodTypeDef,
  unknown
> = z.object({
  source: types.string(),
  headers: z.array(
    z.lazy(() => CreateDeploymentServicesDeploymentsHeaders$inboundSchema),
  ),
  has: types.optional(
    z.array(z.union([
      z.lazy(() => CreateDeploymentHasDeployments1$inboundSchema),
      z.lazy(() =>
        CreateDeploymentHasDeployments2$inboundSchema
      ).and(z.object({ type: z.literal("cookie") })),
      z.lazy(() => CreateDeploymentHasDeployments2$inboundSchema).and(
        z.object({ type: z.literal("header") }),
      ),
      z.lazy(() => CreateDeploymentHasDeployments2$inboundSchema).and(
        z.object({ type: z.literal("query") }),
      ),
    ])),
  ),
  missing: types.optional(
    z.array(z.union([
      z.lazy(() => CreateDeploymentMissingDeployments1$inboundSchema),
      z.lazy(() =>
        CreateDeploymentMissingDeployments2$inboundSchema
      ).and(z.object({ type: z.literal("cookie") })),
      z.lazy(() => CreateDeploymentMissingDeployments2$inboundSchema).and(
        z.object({ type: z.literal("header") }),
      ),
      z.lazy(() => CreateDeploymentMissingDeployments2$inboundSchema).and(
        z.object({ type: z.literal("query") }),
      ),
    ])),
  ),
});

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

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

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

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

/** @internal */
export const CreateDeploymentValueDeploymentsResponse200ApplicationJSONResponseBody2Services2Redirects2$inboundSchema:
  z.ZodType<
    CreateDeploymentValueDeploymentsResponse200ApplicationJSONResponseBody2Services2Redirects2,
    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 createDeploymentValueDeploymentsResponse200ApplicationJSONResponseBody2Services2Redirects2FromJSON(
  jsonString: string,
): SafeParseResult<
  CreateDeploymentValueDeploymentsResponse200ApplicationJSONResponseBody2Services2Redirects2,
  SDKValidationError
> {
  return safeParse(
    jsonString,
    (x) =>
      CreateDeploymentValueDeploymentsResponse200ApplicationJSONResponseBody2Services2Redirects2$inboundSchema
        .parse(JSON.parse(x)),
    `Failed to parse 'CreateDeploymentValueDeploymentsResponse200ApplicationJSONResponseBody2Services2Redirects2' from JSON`,
  );
}

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

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

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

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

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

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

/** @internal */
export const CreateDeploymentValueDeploymentsResponse200ApplicationJSONResponseBody2Services22$inboundSchema:
  z.ZodType<
    CreateDeploymentValueDeploymentsResponse200ApplicationJSONResponseBody2Services22,
    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 createDeploymentValueDeploymentsResponse200ApplicationJSONResponseBody2Services22FromJSON(
  jsonString: string,
): SafeParseResult<
  CreateDeploymentValueDeploymentsResponse200ApplicationJSONResponseBody2Services22,
  SDKValidationError
> {
  return safeParse(
    jsonString,
    (x) =>
      CreateDeploymentValueDeploymentsResponse200ApplicationJSONResponseBody2Services22$inboundSchema
        .parse(JSON.parse(x)),
    `Failed to parse 'CreateDeploymentValueDeploymentsResponse200ApplicationJSONResponseBody2Services22' from JSON`,
  );
}

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

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

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

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

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

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

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

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

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

/** @internal */
export const CreateDeploymentValueDeploymentsResponse200ApplicationJSONResponseBody2Services2RedirectsMissing22$inboundSchema:
  z.ZodType<
    CreateDeploymentValueDeploymentsResponse200ApplicationJSONResponseBody2Services2RedirectsMissing22,
    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 createDeploymentValueDeploymentsResponse200ApplicationJSONResponseBody2Services2RedirectsMissing22FromJSON(
  jsonString: string,
): SafeParseResult<
  CreateDeploymentValueDeploymentsResponse200ApplicationJSONResponseBody2Services2RedirectsMissing22,
  SDKValidationError
> {
  return safeParse(
    jsonString,
    (x) =>
      CreateDeploymentValueDeploymentsResponse200ApplicationJSONResponseBody2Services2RedirectsMissing22$inboundSchema
        .parse(JSON.parse(x)),
    `Failed to parse 'CreateDeploymentValueDeploymentsResponse200ApplicationJSONResponseBody2Services2RedirectsMissing22' from JSON`,
  );
}

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

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

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

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

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

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

/** @internal */
export const CreateDeploymentValueDeploymentsResponse200ApplicationJSONResponseBody2Services2RedirectsMissing2$inboundSchema:
  z.ZodType<
    CreateDeploymentValueDeploymentsResponse200ApplicationJSONResponseBody2Services2RedirectsMissing2,
    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 createDeploymentValueDeploymentsResponse200ApplicationJSONResponseBody2Services2RedirectsMissing2FromJSON(
  jsonString: string,
): SafeParseResult<
  CreateDeploymentValueDeploymentsResponse200ApplicationJSONResponseBody2Services2RedirectsMissing2,
  SDKValidationError
> {
  return safeParse(
    jsonString,
    (x) =>
      CreateDeploymentValueDeploymentsResponse200ApplicationJSONResponseBody2Services2RedirectsMissing2$inboundSchema
        .parse(JSON.parse(x)),
    `Failed to parse 'CreateDeploymentValueDeploymentsResponse200ApplicationJSONResponseBody2Services2RedirectsMissing2' from JSON`,
  );
}

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

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

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

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

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

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

/** @internal */
export const CreateDeploymentServicesRedirects$inboundSchema: z.ZodType<
  CreateDeploymentServicesRedirects,
  z.ZodTypeDef,
  unknown
> = z.object({
  source: types.string(),
  destination: types.string(),
  permanent: types.optional(types.boolean()),
  statusCode: types.optional(types.number()),
  has: types.optional(
    z.array(z.union([
      z.lazy(() => CreateDeploymentHasDeploymentsResponse1$inboundSchema),
      z.lazy(() =>
        CreateDeploymentHasDeploymentsResponse2$inboundSchema
      ).and(z.object({ type: z.literal("cookie") })),
      z.lazy(() => CreateDeploymentHasDeploymentsResponse2$inboundSchema).and(
        z.object({ type: z.literal("header") }),
      ),
      z.lazy(() => CreateDeploymentHasDeploymentsResponse2$inboundSchema).and(
        z.object({ type: z.literal("query") }),
      ),
    ])),
  ),
  missing: types.optional(
    z.array(z.union([
      z.lazy(() => CreateDeploymentMissingDeploymentsResponse1$inboundSchema),
      z.lazy(() =>
        CreateDeploymentMissingDeploymentsResponse2$inboundSchema
      ).and(z.object({ type: z.literal("cookie") })),
      z.lazy(() => CreateDeploymentMissingDeploymentsResponse2$inboundSchema)
        .and(z.object({ type: z.literal("header") })),
      z.lazy(() => CreateDeploymentMissingDeploymentsResponse2$inboundSchema)
        .and(z.object({ type: z.literal("query") })),
    ])),
  ),
  env: types.optional(z.array(types.string())),
});

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

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

/** @internal */
export const CreateDeploymentDestinationDeployments2$inboundSchema: z.ZodType<
  CreateDeploymentDestinationDeployments2,
  z.ZodTypeDef,
  unknown
> = z.object({
  type: types.optional(
    CreateDeploymentDestinationDeploymentsType$inboundSchema,
  ),
  service: types.string(),
  path: types.optional(types.string()),
});

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

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

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

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

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

/** @internal */
export const CreateDeploymentServicesTransforms$inboundSchema: z.ZodType<
  CreateDeploymentServicesTransforms,
  z.ZodTypeDef,
  unknown
> = z.object({
  type: CreateDeploymentServicesDeploymentsResponse200Type$inboundSchema,
  op: CreateDeploymentServicesOp$inboundSchema,
  args: types.string(),
  env: types.optional(z.array(types.string())),
});

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

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

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

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

/** @internal */
export const CreateDeploymentValueDeploymentsResponse200ApplicationJSONResponseBody2Services2RewritesHas2$inboundSchema:
  z.ZodType<
    CreateDeploymentValueDeploymentsResponse200ApplicationJSONResponseBody2Services2RewritesHas2,
    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 createDeploymentValueDeploymentsResponse200ApplicationJSONResponseBody2Services2RewritesHas2FromJSON(
  jsonString: string,
): SafeParseResult<
  CreateDeploymentValueDeploymentsResponse200ApplicationJSONResponseBody2Services2RewritesHas2,
  SDKValidationError
> {
  return safeParse(
    jsonString,
    (x) =>
      CreateDeploymentValueDeploymentsResponse200ApplicationJSONResponseBody2Services2RewritesHas2$inboundSchema
        .parse(JSON.parse(x)),
    `Failed to parse 'CreateDeploymentValueDeploymentsResponse200ApplicationJSONResponseBody2Services2RewritesHas2' from JSON`,
  );
}

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

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

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

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

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

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

/** @internal */
export const CreateDeploymentValueDeploymentsResponse200ApplicationJSONResponseBody2Services2Rewrites2$inboundSchema:
  z.ZodType<
    CreateDeploymentValueDeploymentsResponse200ApplicationJSONResponseBody2Services2Rewrites2,
    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 createDeploymentValueDeploymentsResponse200ApplicationJSONResponseBody2Services2Rewrites2FromJSON(
  jsonString: string,
): SafeParseResult<
  CreateDeploymentValueDeploymentsResponse200ApplicationJSONResponseBody2Services2Rewrites2,
  SDKValidationError
> {
  return safeParse(
    jsonString,
    (x) =>
      CreateDeploymentValueDeploymentsResponse200ApplicationJSONResponseBody2Services2Rewrites2$inboundSchema
        .parse(JSON.parse(x)),
    `Failed to parse 'CreateDeploymentValueDeploymentsResponse200ApplicationJSONResponseBody2Services2Rewrites2' from JSON`,
  );
}

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

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

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

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

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

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

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

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

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

/** @internal */
export const CreateDeploymentValueDeploymentsResponse200ApplicationJSONResponseBody2Services2RewritesMissing22$inboundSchema:
  z.ZodType<
    CreateDeploymentValueDeploymentsResponse200ApplicationJSONResponseBody2Services2RewritesMissing22,
    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 createDeploymentValueDeploymentsResponse200ApplicationJSONResponseBody2Services2RewritesMissing22FromJSON(
  jsonString: string,
): SafeParseResult<
  CreateDeploymentValueDeploymentsResponse200ApplicationJSONResponseBody2Services2RewritesMissing22,
  SDKValidationError
> {
  return safeParse(
    jsonString,
    (x) =>
      CreateDeploymentValueDeploymentsResponse200ApplicationJSONResponseBody2Services2RewritesMissing22$inboundSchema
        .parse(JSON.parse(x)),
    `Failed to parse 'CreateDeploymentValueDeploymentsResponse200ApplicationJSONResponseBody2Services2RewritesMissing22' from JSON`,
  );
}

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

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

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

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

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

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

/** @internal */
export const CreateDeploymentValueDeploymentsResponse200ApplicationJSONResponseBody2Services2RewritesMissing2$inboundSchema:
  z.ZodType<
    CreateDeploymentValueDeploymentsResponse200ApplicationJSONResponseBody2Services2RewritesMissing2,
    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 createDeploymentValueDeploymentsResponse200ApplicationJSONResponseBody2Services2RewritesMissing2FromJSON(
  jsonString: string,
): SafeParseResult<
  CreateDeploymentValueDeploymentsResponse200ApplicationJSONResponseBody2Services2RewritesMissing2,
  SDKValidationError
> {
  return safeParse(
    jsonString,
    (x) =>
      CreateDeploymentValueDeploymentsResponse200ApplicationJSONResponseBody2Services2RewritesMissing2$inboundSchema
        .parse(JSON.parse(x)),
    `Failed to parse 'CreateDeploymentValueDeploymentsResponse200ApplicationJSONResponseBody2Services2RewritesMissing2' from JSON`,
  );
}

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

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

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

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

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

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

/** @internal */
export const ServicesRewrites$inboundSchema: z.ZodType<
  ServicesRewrites,
  z.ZodTypeDef,
  unknown
> = z.object({
  source: types.string(),
  destination: smartUnion([
    z.lazy(() => CreateDeploymentDestinationDeployments2$inboundSchema),
    types.string(),
  ]),
  transforms: types.optional(
    z.array(z.lazy(() => CreateDeploymentServicesTransforms$inboundSchema)),
  ),
  has: types.optional(
    z.array(z.union([
      z.lazy(() => CreateDeploymentHasDeploymentsResponse2001$inboundSchema),
      z.lazy(() =>
        CreateDeploymentHasDeploymentsResponse2002$inboundSchema
      ).and(z.object({ type: z.literal("cookie") })),
      z.lazy(() => CreateDeploymentHasDeploymentsResponse2002$inboundSchema)
        .and(z.object({ type: z.literal("header") })),
      z.lazy(() => CreateDeploymentHasDeploymentsResponse2002$inboundSchema)
        .and(z.object({ type: z.literal("query") })),
    ])),
  ),
  missing: types.optional(
    z.array(z.union([
      z.lazy(() =>
        CreateDeploymentMissingDeploymentsResponse2001$inboundSchema
      ),
      z.lazy(() => CreateDeploymentMissingDeploymentsResponse2002$inboundSchema)
        .and(z.object({ type: z.literal("cookie") })),
      z.lazy(() => CreateDeploymentMissingDeploymentsResponse2002$inboundSchema)
        .and(z.object({ type: z.literal("header") })),
      z.lazy(() => CreateDeploymentMissingDeploymentsResponse2002$inboundSchema)
        .and(z.object({ type: z.literal("query") })),
    ])),
  ),
  statusCode: types.optional(types.number()),
  env: types.optional(z.array(types.string())),
  respectOriginCacheControl: types.optional(types.boolean()),
});

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

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

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

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

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

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

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

/** @internal */
export const CreateDeploymentValueDeploymentsResponse200ApplicationJSONResponseBody2Services2Routes12$inboundSchema:
  z.ZodType<
    CreateDeploymentValueDeploymentsResponse200ApplicationJSONResponseBody2Services2Routes12,
    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 createDeploymentValueDeploymentsResponse200ApplicationJSONResponseBody2Services2Routes12FromJSON(
  jsonString: string,
): SafeParseResult<
  CreateDeploymentValueDeploymentsResponse200ApplicationJSONResponseBody2Services2Routes12,
  SDKValidationError
> {
  return safeParse(
    jsonString,
    (x) =>
      CreateDeploymentValueDeploymentsResponse200ApplicationJSONResponseBody2Services2Routes12$inboundSchema
        .parse(JSON.parse(x)),
    `Failed to parse 'CreateDeploymentValueDeploymentsResponse200ApplicationJSONResponseBody2Services2Routes12' from JSON`,
  );
}

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

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

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

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

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

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

/** @internal */
export const CreateDeploymentValueDeploymentsResponse200ApplicationJSONResponseBody2Services2Routes2$inboundSchema:
  z.ZodType<
    CreateDeploymentValueDeploymentsResponse200ApplicationJSONResponseBody2Services2Routes2,
    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 createDeploymentValueDeploymentsResponse200ApplicationJSONResponseBody2Services2Routes2FromJSON(
  jsonString: string,
): SafeParseResult<
  CreateDeploymentValueDeploymentsResponse200ApplicationJSONResponseBody2Services2Routes2,
  SDKValidationError
> {
  return safeParse(
    jsonString,
    (x) =>
      CreateDeploymentValueDeploymentsResponse200ApplicationJSONResponseBody2Services2Routes2$inboundSchema
        .parse(JSON.parse(x)),
    `Failed to parse 'CreateDeploymentValueDeploymentsResponse200ApplicationJSONResponseBody2Services2Routes2' from JSON`,
  );
}

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

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

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

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

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

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