UNPKG

@vercel/sdk

Version:

<p align="center"> <a href="https://vercel.com"> <img src="https://assets.vercel.com/image/upload/v1588805858/repositories/vercel/logo.png" height="96"> <h3 align="center">Vercel</h3> </a> <p align="center">Develop. Preview. Ship.</p> </p>

5,100 lines 171 kB
/*
 * 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 {
  Locale,
  Locale$inboundSchema,
  Routes2,
  Routes2$inboundSchema,
  Routes3,
  Routes3$inboundSchema,
  RoutesHas,
  RoutesHas$inboundSchema,
  RoutesMissing,
  RoutesMissing$inboundSchema,
  RoutesMitigate,
  RoutesMitigate$inboundSchema,
  RoutesTransforms,
  RoutesTransforms$inboundSchema,
} from "./locale.js";
import { SDKValidationError } from "./sdkvalidationerror.js";

/**
 * Optional explicit format marker. The destination is identified by the presence of `service`, so `type` is no longer required.
 */
export const DestinationType = {
  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 DestinationType = ClosedEnum<typeof DestinationType>;

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

export type RoutesDestination = Destination2 | string;

export type Routes1 = {
  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<RoutesHas> | undefined;
  missing?: Array<RoutesMissing> | undefined;
  mitigate?: RoutesMitigate | undefined;
  transforms?: Array<RoutesTransforms> | undefined;
  env?: Array<string> | undefined;
  locale?: Locale | 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?: Destination2 | 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 CancelDeploymentRoutes = Routes3 | Routes1 | Routes2;

export type ServicesIncludeFiles = string | Array<string>;

export type ServicesExcludeFiles = string | Array<string>;

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

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

export type CancelDeploymentServicesDeploymentsMaxDuration =
  | number
  | CancelDeploymentMaxDurationDeployments2;

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

export type CancelDeploymentServicesDeploymentsAffinity = {
  mode: CancelDeploymentServicesDeploymentsMode;
};

export type CancelDeploymentExperimentalTriggersDeployments3 = {
  /**
   * 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 CancelDeploymentExperimentalTriggersDeployments2 = {
  /**
   * 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 CancelDeploymentExperimentalTriggersDeployments1 = {
  /**
   * 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 CancelDeploymentServicesDeploymentsExperimentalTriggers =
  | CancelDeploymentExperimentalTriggersDeployments1
  | CancelDeploymentExperimentalTriggersDeployments2
  | CancelDeploymentExperimentalTriggersDeployments3;

export type CancelDeploymentServicesDeploymentsFunctions = {
  architecture?: CancelDeploymentServicesDeploymentsArchitecture | undefined;
  memory?: number | undefined;
  maxDuration?: number | CancelDeploymentMaxDurationDeployments2 | undefined;
  affinity?: CancelDeploymentServicesDeploymentsAffinity | undefined;
  maxConcurrency?: number | undefined;
  regions?: Array<string> | undefined;
  functionFailoverRegions?: Array<string> | undefined;
  runtime?: string | undefined;
  includeFiles?: string | undefined;
  excludeFiles?: string | undefined;
  experimentalTriggers?:
    | Array<
      | CancelDeploymentExperimentalTriggersDeployments1
      | CancelDeploymentExperimentalTriggersDeployments2
      | CancelDeploymentExperimentalTriggersDeployments3
    >
    | undefined;
  supportsCancellation?: boolean | undefined;
};

export type CancelDeploymentServicesProjectSettings = {
  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 ServicesMiddlewareRuntime = {
  Nodejs: "nodejs",
} as const;
/**
 * Enforced runtime for explicitly configured Routing Middleware.
 */
export type ServicesMiddlewareRuntime = ClosedEnum<
  typeof ServicesMiddlewareRuntime
>;

export type ServicesMiddlewareMatcher = string | Array<string>;

export type CancelDeploymentServicesConfig = {
  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]: CancelDeploymentServicesDeploymentsFunctions }
    | undefined;
  projectSettings?: CancelDeploymentServicesProjectSettings | 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?: ServicesMiddlewareRuntime | 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 ServicesBuilder = {
  use: string;
  src?: string | undefined;
  config?: CancelDeploymentServicesConfig | undefined;
};

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

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

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

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

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

export type ServicesMaxDuration = number | CancelDeploymentMaxDuration2;

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

export type ServicesAffinity = {
  mode: ServicesMode;
};

export type CancelDeploymentExperimentalTriggers3 = {
  /**
   * 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 CancelDeploymentExperimentalTriggers2 = {
  /**
   * 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 CancelDeploymentExperimentalTriggers1 = {
  /**
   * 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 ServicesExperimentalTriggers =
  | CancelDeploymentExperimentalTriggers1
  | CancelDeploymentExperimentalTriggers2
  | CancelDeploymentExperimentalTriggers3;

/**
 * Function configuration scoped to this service.
 */
export type ServicesFunctions = {
  architecture?: ServicesArchitecture | undefined;
  memory?: number | undefined;
  maxDuration?: number | CancelDeploymentMaxDuration2 | undefined;
  affinity?: ServicesAffinity | undefined;
  maxConcurrency?: number | undefined;
  regions?: Array<string> | undefined;
  functionFailoverRegions?: Array<string> | undefined;
  runtime?: string | undefined;
  includeFiles?: string | undefined;
  excludeFiles?: string | undefined;
  experimentalTriggers?:
    | Array<
      | CancelDeploymentExperimentalTriggers1
      | CancelDeploymentExperimentalTriggers2
      | CancelDeploymentExperimentalTriggers3
    >
    | undefined;
  supportsCancellation?: boolean | undefined;
};

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

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

export type CancelDeploymentValueDeploymentsResponse200Eq = string | number;

export type CancelDeploymentValueDeploymentsResponse200ApplicationJson2 = {
  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 CancelDeploymentHasDeploymentsValue =
  | string
  | CancelDeploymentValueDeploymentsResponse200ApplicationJson2;

export type CancelDeploymentHas2 = {
  type: CancelDeploymentHasDeploymentsResponseType;
  key: string;
  value?:
    | string
    | CancelDeploymentValueDeploymentsResponse200ApplicationJson2
    | undefined;
};

export type CancelDeploymentValueDeploymentsResponseEq = string | number;

export type CancelDeploymentValueDeploymentsResponse200ApplicationJSONResponseBodyServices2Headers2 =
  {
    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 CancelDeploymentHasDeploymentsResponse200ApplicationJSONResponseBodyServicesValue =
  | string
  | CancelDeploymentValueDeploymentsResponse200ApplicationJSONResponseBodyServices2Headers2;

export type CancelDeploymentHas1 = {
  type: "host";
  value:
    | string
    | CancelDeploymentValueDeploymentsResponse200ApplicationJSONResponseBodyServices2Headers2;
};

export type ServicesHas =
  | CancelDeploymentHas1
  | (CancelDeploymentHas2 & { type: "cookie" })
  | (CancelDeploymentHas2 & { type: "header" })
  | (CancelDeploymentHas2 & { type: "query" });

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

export type CancelDeploymentValueDeploymentsResponse200ApplicationJSONResponseBodyEq =
  | string
  | number;

export type CancelDeploymentValueDeploymentsResponse200ApplicationJSONResponseBodyServices2 =
  {
    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 CancelDeploymentMissingDeploymentsResponseValue =
  | string
  | CancelDeploymentValueDeploymentsResponse200ApplicationJSONResponseBodyServices2;

export type CancelDeploymentMissing2 = {
  type: CancelDeploymentMissingDeploymentsResponseType;
  key: string;
  value?:
    | string
    | CancelDeploymentValueDeploymentsResponse200ApplicationJSONResponseBodyServices2
    | undefined;
};

export type CancelDeploymentValueDeploymentsResponse200ApplicationJSONEq =
  | string
  | number;

export type CancelDeploymentValueDeploymentsResponse200ApplicationJSONResponseBody2 =
  {
    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 CancelDeploymentMissingDeploymentsValue =
  | string
  | CancelDeploymentValueDeploymentsResponse200ApplicationJSONResponseBody2;

export type CancelDeploymentMissing1 = {
  type: "host";
  value:
    | string
    | CancelDeploymentValueDeploymentsResponse200ApplicationJSONResponseBody2;
};

export type ServicesMissing =
  | CancelDeploymentMissing1
  | (CancelDeploymentMissing2 & { type: "cookie" })
  | (CancelDeploymentMissing2 & { type: "header" })
  | (CancelDeploymentMissing2 & { type: "query" });

export type ServicesHeaders = {
  source: string;
  headers: Array<CancelDeploymentServicesHeaders>;
  has?:
    | Array<
      | CancelDeploymentHas1
      | (CancelDeploymentHas2 & { type: "cookie" })
      | (CancelDeploymentHas2 & { type: "header" })
      | (CancelDeploymentHas2 & { type: "query" })
    >
    | undefined;
  missing?:
    | Array<
      | CancelDeploymentMissing1
      | (CancelDeploymentMissing2 & { type: "cookie" })
      | (CancelDeploymentMissing2 & { type: "header" })
      | (CancelDeploymentMissing2 & { type: "query" })
    >
    | undefined;
};

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

export type CancelDeploymentValueDeploymentsResponse200ApplicationJSONResponseBodyServices2Eq =
  | string
  | number;

export type CancelDeploymentValueDeploymentsResponse200ApplicationJSONResponseBodyServices2Redirects2 =
  {
    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 CancelDeploymentHasDeploymentsResponse200Value =
  | string
  | CancelDeploymentValueDeploymentsResponse200ApplicationJSONResponseBodyServices2Redirects2;

export type CancelDeploymentHasDeployments2 = {
  type: CancelDeploymentHasDeploymentsResponse200ApplicationJSONType;
  key: string;
  value?:
    | string
    | CancelDeploymentValueDeploymentsResponse200ApplicationJSONResponseBodyServices2Redirects2
    | undefined;
};

export type CancelDeploymentValueDeploymentsResponse200ApplicationJSONResponseBodyServicesEq =
  | string
  | number;

export type CancelDeploymentValueDeploymentsResponse200ApplicationJSONResponseBodyServices22 =
  {
    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 CancelDeploymentHasDeploymentsResponseValue =
  | string
  | CancelDeploymentValueDeploymentsResponse200ApplicationJSONResponseBodyServices22;

export type CancelDeploymentHasDeployments1 = {
  type: "host";
  value:
    | string
    | CancelDeploymentValueDeploymentsResponse200ApplicationJSONResponseBodyServices22;
};

export type CancelDeploymentServicesHas =
  | CancelDeploymentHasDeployments1
  | (CancelDeploymentHasDeployments2 & { type: "cookie" })
  | (CancelDeploymentHasDeployments2 & { type: "header" })
  | (CancelDeploymentHasDeployments2 & { type: "query" });

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

export type CancelDeploymentValueDeploymentsResponse200ApplicationJSONResponseBodyServices2RedirectsMissingEq =
  | string
  | number;

export type CancelDeploymentValueDeploymentsResponse200ApplicationJSONResponseBodyServices2RedirectsMissing22 =
  {
    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 CancelDeploymentMissingDeploymentsResponse200ApplicationJSONValue =
  | string
  | CancelDeploymentValueDeploymentsResponse200ApplicationJSONResponseBodyServices2RedirectsMissing22;

export type CancelDeploymentMissingDeployments2 = {
  type: CancelDeploymentMissingDeploymentsResponse200ApplicationJSONType;
  key: string;
  value?:
    | string
    | CancelDeploymentValueDeploymentsResponse200ApplicationJSONResponseBodyServices2RedirectsMissing22
    | undefined;
};

export type CancelDeploymentValueDeploymentsResponse200ApplicationJSONResponseBodyServices2RedirectsEq =
  | string
  | number;

export type CancelDeploymentValueDeploymentsResponse200ApplicationJSONResponseBodyServices2RedirectsMissing2 =
  {
    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 CancelDeploymentMissingDeploymentsResponse200Value =
  | string
  | CancelDeploymentValueDeploymentsResponse200ApplicationJSONResponseBodyServices2RedirectsMissing2;

export type CancelDeploymentMissingDeployments1 = {
  type: "host";
  value:
    | string
    | CancelDeploymentValueDeploymentsResponse200ApplicationJSONResponseBodyServices2RedirectsMissing2;
};

export type CancelDeploymentServicesMissing =
  | CancelDeploymentMissingDeployments1
  | (CancelDeploymentMissingDeployments2 & { type: "cookie" })
  | (CancelDeploymentMissingDeployments2 & { type: "header" })
  | (CancelDeploymentMissingDeployments2 & { type: "query" });

export type ServicesRedirects = {
  source: string;
  destination: string;
  permanent?: boolean | undefined;
  statusCode?: number | undefined;
  has?:
    | Array<
      | CancelDeploymentHasDeployments1
      | (CancelDeploymentHasDeployments2 & { type: "cookie" })
      | (CancelDeploymentHasDeployments2 & { type: "header" })
      | (CancelDeploymentHasDeployments2 & { type: "query" })
    >
    | undefined;
  missing?:
    | Array<
      | CancelDeploymentMissingDeployments1
      | (CancelDeploymentMissingDeployments2 & { type: "cookie" })
      | (CancelDeploymentMissingDeployments2 & { type: "header" })
      | (CancelDeploymentMissingDeployments2 & { 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 CancelDeploymentDestinationType = {
  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 CancelDeploymentDestinationType = ClosedEnum<
  typeof CancelDeploymentDestinationType
>;

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

export type ServicesDestination = CancelDeploymentDestination2 | string;

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

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

export type ServicesTransforms = {
  type: CancelDeploymentServicesDeploymentsResponseType;
  op: ServicesOp;
  args: string;
  env?: Array<string> | undefined;
};

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

export type CancelDeploymentValueDeploymentsResponse200ApplicationJSONResponseBodyServices2RewritesHasEq =
  | string
  | number;

export type CancelDeploymentValueDeploymentsResponse200ApplicationJSONResponseBodyServices2RewritesHas2 =
  {
    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 CancelDeploymentHasDeploymentsResponse200ApplicationJSONResponseBodyValue =
  | string
  | CancelDeploymentValueDeploymentsResponse200ApplicationJSONResponseBodyServices2RewritesHas2;

export type CancelDeploymentHasDeploymentsResponse2 = {
  type:
    CancelDeploymentHasDeploymentsResponse200ApplicationJSONResponseBodyServicesType;
  key: string;
  value?:
    | string
    | CancelDeploymentValueDeploymentsResponse200ApplicationJSONResponseBodyServices2RewritesHas2
    | undefined;
};

export type CancelDeploymentValueDeploymentsResponse200ApplicationJSONResponseBodyServices2RewritesEq =
  | string
  | number;

export type CancelDeploymentValueDeploymentsResponse200ApplicationJSONResponseBodyServices2Rewrites2 =
  {
    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 CancelDeploymentHasDeploymentsResponse200ApplicationJSONValue =
  | string
  | CancelDeploymentValueDeploymentsResponse200ApplicationJSONResponseBodyServices2Rewrites2;

export type CancelDeploymentHasDeploymentsResponse1 = {
  type: "host";
  value:
    | string
    | CancelDeploymentValueDeploymentsResponse200ApplicationJSONResponseBodyServices2Rewrites2;
};

export type CancelDeploymentServicesDeploymentsHas =
  | CancelDeploymentHasDeploymentsResponse1
  | (CancelDeploymentHasDeploymentsResponse2 & { type: "cookie" })
  | (CancelDeploymentHasDeploymentsResponse2 & { type: "header" })
  | (CancelDeploymentHasDeploymentsResponse2 & { type: "query" });

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

export type CancelDeploymentValueDeploymentsResponse200ApplicationJSONResponseBodyServices2RewritesMissing2Eq =
  | string
  | number;

export type CancelDeploymentValueDeploymentsResponse200ApplicationJSONResponseBodyServices2RewritesMissing22 =
  {
    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 CancelDeploymentMissingDeploymentsResponse200ApplicationJSONResponseBodyServicesValue =
  | string
  | CancelDeploymentValueDeploymentsResponse200ApplicationJSONResponseBodyServices2RewritesMissing22;

export type CancelDeploymentMissingDeploymentsResponse2 = {
  type:
    CancelDeploymentMissingDeploymentsResponse200ApplicationJSONResponseBodyServicesType;
  key: string;
  value?:
    | string
    | CancelDeploymentValueDeploymentsResponse200ApplicationJSONResponseBodyServices2RewritesMissing22
    | undefined;
};

export type CancelDeploymentValueDeploymentsResponse200ApplicationJSONResponseBodyServices2RewritesMissingEq =
  | string
  | number;

export type CancelDeploymentValueDeploymentsResponse200ApplicationJSONResponseBodyServices2RewritesMissing2 =
  {
    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 CancelDeploymentMissingDeploymentsResponse200ApplicationJSONResponseBodyValue =
  | string
  | CancelDeploymentValueDeploymentsResponse200ApplicationJSONResponseBodyServices2RewritesMissing2;

export type CancelDeploymentMissingDeploymentsResponse1 = {
  type: "host";
  value:
    | string
    | CancelDeploymentValueDeploymentsResponse200ApplicationJSONResponseBodyServices2RewritesMissing2;
};

export type CancelDeploymentServicesDeploymentsMissing =
  | CancelDeploymentMissingDeploymentsResponse1
  | (CancelDeploymentMissingDeploymentsResponse2 & { type: "cookie" })
  | (CancelDeploymentMissingDeploymentsResponse2 & { type: "header" })
  | (CancelDeploymentMissingDeploymentsResponse2 & { type: "query" });

export type Rewrites = {
  source: string;
  destination: CancelDeploymentDestination2 | string;
  transforms?: Array<ServicesTransforms> | undefined;
  has?:
    | Array<
      | CancelDeploymentHasDeploymentsResponse1
      | (CancelDeploymentHasDeploymentsResponse2 & { type: "cookie" })
      | (CancelDeploymentHasDeploymentsResponse2 & { type: "header" })
      | (CancelDeploymentHasDeploymentsResponse2 & { type: "query" })
    >
    | undefined;
  missing?:
    | Array<
      | CancelDeploymentMissingDeploymentsResponse1
      | (CancelDeploymentMissingDeploymentsResponse2 & { type: "cookie" })
      | (CancelDeploymentMissingDeploymentsResponse2 & { type: "header" })
      | (CancelDeploymentMissingDeploymentsResponse2 & { type: "query" })
    >
    | undefined;
  statusCode?: number | undefined;
  env?: Array<string> | undefined;
  respectOriginCacheControl?: boolean | undefined;
};

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

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

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

export type CancelDeploymentValueDeploymentsResponse200ApplicationJSONResponseBodyServices2Routes1Eq =
  | string
  | number;

export type CancelDeploymentValueDeploymentsResponse200ApplicationJSONResponseBodyServices2Routes12 =
  {
    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 CancelDeploymentHasDeploymentsResponse200ApplicationJSONResponseBodyServices2Value =
  | string
  | CancelDeploymentValueDeploymentsResponse200ApplicationJSONResponseBodyServices2Routes12;

export type CancelDeploymentHasDeploymentsResponse2002 = {
  type:
    CancelDeploymentHasDeploymentsResponse200ApplicationJSONResponseBodyServices2RoutesType;
  key: string;
  value?:
    | string
    | CancelDeploymentValueDeploymentsResponse200ApplicationJSONResponseBodyServices2Routes12
    | undefined;
};

export type CancelDeploymentValueDeploymentsResponse200ApplicationJSONResponseBodyServices2RoutesEq =
  | string
  | number;

export type CancelDeploymentValueDeploymentsResponse200ApplicationJSONResponseBodyServices2Routes2 =
  {
    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 CancelDeploymentHasDeploymentsResponse200ApplicationJSONResponseBodyServices2RoutesValue =
  | string
  | CancelDeploymentValueDeploymentsResponse200ApplicationJSONResponseBodyServices2Routes2;

export type CancelDeploymentHasDeploymentsResponse2001 = {
  type: "host";
  value:
    | string
    | CancelDeploymentValueDeploymentsResponse200ApplicationJSONResponseBodyServices2Routes2;
};

export type CancelDeploymentRoutesHas =
  | CancelDeploymentHasDeploymentsResponse2001
  | (CancelDeploymentHasDeploymentsResponse2002 & { type: "cookie" })
  | (CancelDeploymentHasDeploymentsResponse2002 & { type: "header" })
  | (CancelDeploymentHasDeploymentsResponse2002 & { type: "query" });

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

export type CancelDeploymentValueDeploymentsResponse200ApplicationJSONResponseBodyServices2Routes1Missing2Eq =
  | string
  | number;

export type CancelDeploymentValueDeploymentsResponse200ApplicationJSONResponseBodyServices2Routes1Missing22 =
  {
    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 CancelDeploymentMissingDeploymentsResponse200ApplicationJSONResponseBodyServices2RoutesValue =
  | string
  | CancelDeploymentValueDeploymentsResponse200ApplicationJSONResponseBodyServices2Routes1Missing22;

export type CancelDeploymentMissingDeploymentsResponse2002 = {
  type:
    CancelDeploymentMissingDeploymentsResponse200ApplicationJSONResponseBodyServices2RoutesType;
  key: string;
  value?:
    | string
    | CancelDeploymentValueDeploymentsResponse200ApplicationJSONResponseBodyServices2Routes1Missing22
    | undefined;
};

export type CancelDeploymentValueDeploymentsResponse200ApplicationJSONResponseBodyServices2Routes1MissingEq =
  | string
  | number;

export type CancelDeploymentValueDeploymentsResponse200ApplicationJSONResponseBodyServices2Routes1Missing2 =
  {
    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 CancelDeploymentMissingDeploymentsResponse200ApplicationJSONResponseBodyServices2Value =
  | string
  | CancelDeploymentValueDeploymentsResponse200ApplicationJSONResponseBodyServices2Routes1Missing2;

export type CancelDeploymentMissingDeploymentsResponse2001 = {
  type: "host";
  value:
    | string
    | CancelDeploymentValueDeploymentsResponse200ApplicationJSONResponseBodyServices2Routes1Missing2;
};

export type CancelDeploymentRoutesMissing =
  | CancelDeploymentMissingDeploymentsResponse2001
  | (CancelDeploymentMissingDeploymentsResponse2002 & { type: "cookie" })
  | (CancelDeploymentMissingDeploymentsResponse2002 & { type: "header" })
  | (CancelDeploymentMissingDeploymentsResponse2002 & { type: "query" });

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

export type CancelDeploymentRoutesMitigate = {
  action: CancelDeploymentRoutesAction;
};

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

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

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

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

export type CancelDeploymentKeyEq = string | number;

export type CancelDeploymentKey2 = {
  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 CancelDeploymentTransformsDeploymentsKey =
  | string
  | CancelDeploymentKey2;

export type CancelDeploymentTransformsTarget = {
  key: string | CancelDeploymentKey2;
};

export type CancelDeploymentTransformsArgs = string | Array<string>;

export type CancelDeploymentTransforms1 = {
  type: CancelDeploymentTransformsDeploymentsType;
  op: CancelDeploymentTransformsDeploymentsResponseOp;
  target: CancelDeploymentTransformsTarget;
  args?: string | Array<string> | undefined;
  env?: Array<string> | undefined;
};

export type CancelDeploymentRoutesTransforms =
  | (CancelDeploymentTransforms1 & { type: "request.headers" })
  | (CancelDeploymentTransforms1 & { type: "request.query" })
  | (CancelDeploymentTransforms1 & { type: "response.headers" })
  | CancelDeploymentTransforms2;

export type CancelDeploymentRoutesLocale = {
  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 CancelDeploymentDestinationDeploymentsType = {
  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 CancelDeploymentDestinationDeploymentsType = ClosedEnum<
  typeof CancelDeploymentDestinationDeploymentsType
>;

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

export type CancelDeploymentRoutesDestination =
  | CancelDeploymentDestinationDeployments2
  | string;

export type CancelDeploymentRoutes1 = {
  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<
      | CancelDeploymentHasDeploymentsResponse2001
      | (CancelDeploymentHasDeploymentsResponse2002 & { type: "cookie" })
      | (CancelDeploymentHasDeploymentsResponse2002 & { type: "header" })
      | (CancelDeploymentHasDeploymentsResponse2002 & { type: "query" })
    >
    | undefined;
  missing?:
    | Array<
      | CancelDeploymentMissingDeploymentsResponse2001
      | (CancelDeploymentMissingDeploymentsResponse2002 & { type: "cookie" })
      | (CancelDeploymentMissingDeploymentsResponse2002 & { type: "header" })
      | (CancelDeploymentMissingDeploymentsResponse2002 & { type: "query" })
    >
    | undefined;
  mitigate?: CancelDeploymentRoutesMitigate | undefined;
  transforms?:
    | Array<
      | (CancelDeploymentTransforms1 & { type: "request.headers" })
      | (CancelDeploymentTransforms1 & { type: "request.query" })
      | (CancelDeploymentTransforms1 & { type: "response.headers" })
      | CancelDeploymentTransforms2
    >
    | undefined;
  env?: Array<string> | undefined;
  locale?: CancelDeploymentRoutesLocale | 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?: CancelDeploymentDestinationDeployments2 | 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 ServicesRoutes = CancelDeploymentRoutes1 | CancelDeploymentRoutes2;

/**
 * Services detected during build from vercel.json experimentalServices or auto-detected from project structure. Used to inject service URLs as environment variables at runtime.
 */
export type Services2 = {
  schema: "experimentalServicesV2";
  name: string;
  /**
   * Path to the service root, relative to the project root.
   */
  root: string;
  framework?: string | undefined;
  runtime?: string | undefined;
  /**
   * Resolved entrypoint, relative to the service root.
   */
  entrypoint?: string | undefined;
  /**
   * Command override for `runtime: "container"` services.
   */
  command?: Array<string> | undefined;
  /**
   * Builder selected by the resolver.
   */
  builder: ServicesBuilder;
  installCommand?: string | undefined;
  buildCommand?: string | undefined;
  devCommand?: string | undefined;
  ignoreCommand?: string | undefined;
  outputDirectory?: string | undefined;
  /**
   * Caller-side bindings to other services.
   */
  bindings?: Array<Bindings> | undefined;
  /**
   * Function configuration scoped to this service.
   */
  functions?: { [k: string]: ServicesFunctions } | undefined;
  headers?: Array<ServicesHeaders> | undefined;
  redirects?: Array<ServicesRedirects> | undefined;
  rewrites?: Array<Rewrites> | undefined;
  routes?: Array<CancelDeploymentRoutes1 | CancelDeploymentRoutes2> | undefined;
  cleanUrls?: boolean | undefined;
  trailingSlash?: boolean | undefined;
};

export const ServicesType = {
  Cron: "cron",
  Job: "job",
  Web: "web",
  Worker: "worker",
} as const;
export type ServicesType = ClosedEnum<typeof ServicesType>;

export const Trigger = {
  Queue: "queue",
  Schedule: "schedule",
  Workflow: "workflow",
} as const;
export type Trigger = ClosedEnum<typeof Trigger>;

export type IncludeFiles = string | Array<string>;

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

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

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

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

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

/** @internal */
export const Routes1$inboundSchema: z.ZodType<Routes1, 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(RoutesHas$inboundSchema)),
    missing: types.optional(z.array(RoutesMissing$inboundSchema)),
    mitigate: types.optional(RoutesMitigate$inboundSchema),
    transforms: types.optional(z.array(RoutesTransforms$inboundSchema)),
    env: types.optional(z.array(types.string())),
    locale: types.optional(Locale$inboundSchema),
    source: types.optional(types.string()),
    destination: types.optional(
      smartUnion([z.lazy(() => Destination2$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 routes1FromJSON(
  jsonString: string,
): SafeParseResult<Routes1, SDKValidationError> {
  return safeParse(
    jsonString,
    (x) => Routes1$inboundSchema.parse(JSON.parse(x)),
    `Failed to parse 'Routes1' from JSON`,
  );
}

/** @internal */
export const CancelDeploymentRoutes$inboundSchema: z.ZodType<
  CancelDeploymentRoutes,
  z.ZodTypeDef,
  unknown
> = smartUnion([
  Routes3$inboundSchema,
  z.lazy(() => Routes1$inboundSchema),
  Routes2$inboundSchema,
]);

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

/** @internal */
export const CancelDeploymentServicesDeploymentsExperimentalTriggers$inboundSchema:
  z.ZodType<
    CancelDeploymentServicesDeploymentsExperimentalTriggers,
    z.ZodTypeDef,
    unknown
  > = z.union([
    z.lazy(() =>
      CancelDeploymentExperimentalTriggersDeployments1$inboundSchema
    ),
    z.lazy(() =>
      CancelDeploymentExperimentalTriggersDeployments2$inboundSchema
    ),
    z.lazy(() =>
      CancelDeploymentExperimentalTriggersDeployments3$inboundSchema
    ),
  ]);

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

/** @internal */
export const CancelDeploymentServicesDeploymentsFunctions$inboundSchema:
  z.ZodType<
    CancelDeploymentServicesDeploymentsFunctions,
    z.ZodTypeDef,
    unknown
  > = z.object({
    architecture: types.optional(
      CancelDeploymentServicesDeploymentsArchitecture$inboundSchema,
    ),
    memory: types.optional(types.number()),
    maxDuration: types.optional(
      smartUnion([
        types.number(),
        CancelDeploymentMaxDurationDeployments2$inboundSchema,
      ]),
    ),
    affinity: types.optional(
      z.lazy(() => CancelDeploymentServicesDeploymentsAffinity$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(() =>
          CancelDeploymentExperimentalTriggersDeployments1$inboundSchema
        ),
        z.lazy(() =>
          CancelDeploymentExperimentalTriggersDeployments2$inboundSchema
        ),
        z.lazy(() =>
          CancelDeploymentExperimentalTriggersDeployments3$inboundSchema
        ),
      ])),
    ),
    supportsCancellation: types.optional(types.boolean()),
  });

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

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

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

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

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

/** @internal */
export const CancelDeploymentServicesConfig$inboundSchema: z.ZodType<
  CancelDeploymentServicesConfig,
  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(() =>
      CancelDeploymentServicesDeploymentsFunctions$inboundSchema
    )),
  ),
  projectSettings: types.optional(
    z.lazy(() => CancelDeploymentServicesProjectSettings$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(ServicesMiddlewareRuntime$inboundSchema),
  middlewareMatcher: types.optional(
    smartUnion([types.string(), z.array(types.string())]),
  ),
  serviceName: types.optional(types.string()),
});

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

/** @internal */
export const ServicesExperimentalTriggers$inboundSchema: z.ZodType<
  ServicesExperimentalTriggers,
  z.ZodTypeDef,
  unknown
> = z.union([
  z.lazy(() => CancelDeploymentExperimentalTriggers1$inboundSchema),
  z.lazy(() => CancelDeploymentExperimentalTriggers2$inboundSchema),
  z.lazy(() => CancelDeploymentExperimentalTriggers3$inboundSchema),
]);

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

/** @internal */
export const ServicesFunctions$inboundSchema: z.ZodType<
  ServicesFunctions,
  z.ZodTypeDef,
  unknown
> = z.object({
  architecture: types.optional(ServicesArchitecture$inboundSchema),
  memory: types.optional(types.number()),
  maxDuration: types.optional(
    smartUnion([types.number(), CancelDeploymentMaxDuration2$inboundSchema]),
  ),
  affinity: types.optional(z.lazy(() => ServicesAffinity$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(() => CancelDeploymentExperimentalTriggers1$inboundSchema),
      z.lazy(() =>
        CancelDeploymentExperimentalTriggers2$inboundSchema
      ),
      z.lazy(() => CancelDeploymentExperimentalTriggers3$inboundSchema),
    ])),
  ),
  supportsCancellation: types.optional(types.boolean()),
});

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

/** @internal */
export const ServicesHeaders$inboundSchema: z.ZodType<
  ServicesHeaders,
  z.ZodTypeDef,
  unknown
> = z.object({
  source: types.string(),
  headers: z.array(z.lazy(() => CancelDeploymentServicesHeaders$inboundSchema)),
  has: types.optional(
    z.array(z.union([
      z.lazy(() => CancelDeploymentHas1$inboundSchema),
      z.lazy(() =>
        CancelDeploymentHas2$inboundSchema
      ).and(z.object({ type: z.literal("cookie") })),
      z.lazy(() => CancelDeploymentHas2$inboundSchema).and(
        z.object({ type: z.literal("header") }),
      ),
      z.lazy(() => CancelDeploymentHas2$inboundSchema).and(
        z.object({ type: z.literal("query") }),
      ),
    ])),
  ),
  missing: types.optional(
    z.array(z.union([
      z.lazy(() => CancelDeploymentMissing1$inboundSchema),
      z.lazy(() =>
        CancelDeploymentMissing2$inboundSchema
      ).and(z.object({ type: z.literal("cookie") })),
      z.lazy(() => CancelDeploymentMissing2$inboundSchema).and(
        z.object({ type: z.literal("header") }),
      ),
      z.lazy(() => CancelDeploymentMissing2$inboundSchema).and(
        z.object({ type: z.literal("query") }),
      ),
    ])),
  ),
});

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

/** @internal */
export const ServicesRedirects$inboundSchema: z.ZodType<
  ServicesRedirects,
  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(() => CancelDeploymentHasDeployments1$inboundSchema),
      z.lazy(() =>
        CancelDeploymentHasDeployments2$inboundSchema
      ).and(z.object({ type: z.literal("cookie") })),
      z.lazy(() => CancelDeploymentHasDeployments2$inboundSchema).and(
        z.object({ type: z.literal("header") }),
      ),
      z.lazy(() => CancelDeploymentHasDeployments2$inboundSchema).and(
        z.object({ type: z.literal("query") }),
      ),
    ])),
  ),
  missing: types.optional(
    z.array(z.union([
      z.lazy(() => CancelDeploymentMissingDeployments1$inboundSchema),
      z.lazy(() =>
        CancelDeploymentMissingDeployments2$inboundSchema
      ).and(z.object({ type: z.literal("cookie") })),
      z.lazy(() => CancelDeploymentMissingDeployments2$inboundSchema).and(
        z.object({ type: z.literal("header") }),
      ),
      z.lazy(() => CancelDeploymentMissingDeployments2$inboundSchema).and(
        z.object({ type: z.literal("query") }),
      ),
    ])),
  ),
  env: types.optional(z.array(types.string())),
});

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

/** @internal */
export const Rewrites$inboundSchema: z.ZodType<
  Rewrites,
  z.ZodTypeDef,
  unknown
> = z.object({
  source: types.string(),
  destination: smartUnion([
    z.lazy(() => CancelDeploymentDestination2$inboundSchema),
    types.string(),
  ]),
  transforms: types.optional(
    z.array(z.lazy(() => ServicesTransforms$inboundSchema)),
  ),
  has: types.optional(
    z.array(z.union([
      z.lazy(() => CancelDeploymentHasDeploymentsResponse1$inboundSchema),
      z.lazy(() =>
        CancelDeploymentHasDeploymentsResponse2$inboundSchema
      ).and(z.object({ type: z.literal("cookie") })),
      z.lazy(() => CancelDeploymentHasDeploymentsResponse2$inboundSchema).and(
        z.object({ type: z.literal("header") }),
      ),
      z.lazy(() => CancelDeploymentHasDeploymentsResponse2$inboundSchema).and(
        z.object({ type: z.literal("query") }),
      ),
    ])),
  ),
  missing: types.optional(
    z.array(z.union([
      z.lazy(() => CancelDeploymentMissingDeploymentsResponse1$inboundSchema),
      z.lazy(() =>
        CancelDeploymentMissingDeploymentsResponse2$inboundSchema
      ).and(z.object({ type: z.literal("cookie") })),
      z.lazy(() => CancelDeploymentMissingDeploymentsResponse2$inboundSchema)
        .and(z.object({ type: z.literal("header") })),
      z.lazy(() => CancelDeploymentMissingDeploymentsResponse2$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 rewritesFromJSON(
  jsonString: string,
): SafeParseResult<Rewrites, SDKValidationError> {
  return safeParse(
    jsonString,
    (x) => Rewrites$inboundSchema.parse(JSON.parse(x)),
    `Failed to parse 'Rewrites' from JSON`,
  );
}

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

/** @internal */
export const CancelDeploymentRoutes1$inboundSchema: z.ZodType<
  CancelDeploymentRoutes1,
  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(() => CancelDeploymentHasDeploymentsResponse2001$inboundSchema),
      z.lazy(() =>
        CancelDeploymentHasDeploymentsResponse2002$inboundSchema
      ).and(z.object({ type: z.literal("cookie") })),
      z.lazy(() => CancelDeploymentHasDeploymentsResponse2002$inboundSchema)
        .and(z.object({ type: z.literal("header") })),
      z.lazy(() => CancelDeploymentHasDeploymentsResponse2002$inboundSchema)
        .and(z.object({ type: z.literal("query") })),
    ])),
  ),
  missing: types.optional(
    z.array(z.union([
      z.lazy(() =>
        CancelDeploymentMissingDeploymentsResponse2001$inboundSchema
      ),
      z.lazy(() => CancelDeploymentMissingDeploymentsResponse2002$inboundSchema)
        .and(z.object({ type: z.literal("cookie") })),
      z.lazy(() => CancelDeploymentMissingDeploymentsResponse2002$inboundSchema)
        .and(z.object({ type: z.literal("header") })),
      z.lazy(() => CancelDeploymentMissingDeploymentsResponse2002$inboundSchema)
        .and(z.object({ type: z.literal("query") })),
    ])),
  ),
  mitigate: types.optional(
    z.lazy(() => CancelDeploymentRoutesMitigate$inboundSchema),
  ),
  transforms: types.optional(
    z.array(z.union([
      z.lazy(() => CancelDeploymentTransforms1$inboundSchema).and(
        z.object({ type: z.literal("request.headers") }),
      ),
      z.lazy(() => CancelDeploymentTransforms1$inboundSchema).and(
        z.object({ type: z.literal("request.query") }),
      ),
      z.lazy(() => CancelDeploymentTransforms1$inboundSchema).and(
        z.object({ type: z.literal("response.headers") }),
      ),
      z.lazy(() => CancelDeploymentTransforms2$inboundSchema),
    ])),
  ),
  env: types.optional(z.array(types.string())),
  locale: types.optional(
    z.lazy(() => CancelDeploymentRoutesLocale$inboundSchema),
  ),
  source: types.optional(types.string()),
  destination: types.optional(
    smartUnion([
      z.lazy(() => CancelDeploymentDestinationDeployments2$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 cancelDeploymentRoutes1FromJSON(
  jsonString: string,
): SafeParseResult<CancelDeploymentRoutes1, SDKValidationError> {
  return safeParse(
    jsonString,
    (x) => CancelDeploymentRoutes1$inboundSchema.parse(JSON.parse(x)),
    `Failed to parse 'CancelDeploymentRoutes1' from JSON`,
  );
}

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

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

/** @internal */
export const Services2$inboundSchema: z.ZodType<
  Services2,
  z.ZodTypeDef,
  unknown
> = z.object({
  schema: types.literal("experimentalServicesV2"),
  name: types.string(),
  root: types.string(),
  framework: types.optional(types.string()),
  runtime: types.optional(types.string()),
  entrypoint: types.optional(types.string()),
  command: types.optional(z.array(types.string())),
  builder: z.lazy(() => ServicesBuilder$inboundSchema),
  installCommand: types.optional(types.string()),
  buildCommand: types.optional(types.string()),
  devCommand: types.optional(types.string()),
  ignoreCommand: types.optional(types.string()),
  outputDirectory: types.optional(types.string()),
  bindings: types.optional(z.array(z.lazy(() => Bindings$inboundSchema))),
  functions: types.optional(
    z.record(z.lazy(() => ServicesFunctions$inboundSchema)),
  ),
  headers: types.optional(z.array(z.lazy(() => ServicesHeaders$inboundSchema))),
  redirects: types.optional(
    z.array(z.lazy(() => ServicesRedirects$inboundSchema)),
  ),
  rewrites: types.optional(z.array(z.lazy(() => Rewrites$inboundSchema))),
  routes: types.optional(
    z.array(smartUnion([
      z.lazy(() => CancelDeploymentRoutes1$inboundSchema),
      z.lazy(() =>
        CancelDeploymentRoutes2$inboundSchema
      ),
    ])),
  ),
  cleanUrls: types.optional(types.boolean()),
  trailingSlash: types.optional(types.boolean()),
});

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

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

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

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

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