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

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

/**
 * Pattern syntax type. If not provided, inferred from pattern.
 */
export const EditRouteSrcSyntax = {
  Equals: "equals",
  PathToRegexp: "path-to-regexp",
  Regex: "regex",
} as const;
/**
 * Pattern syntax type. If not provided, inferred from pattern.
 */
export type EditRouteSrcSyntax = ClosedEnum<typeof EditRouteSrcSyntax>;

export type EditRouteHeaders = {};

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

export type EditRouteHas = {
  type?: EditRouteType | undefined;
  key?: string | undefined;
  value?: string | undefined;
};

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

export type EditRouteMissing = {
  type?: EditRouteProjectRoutesType | undefined;
  key?: string | undefined;
  value?: string | undefined;
};

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

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

export type EditRouteTarget = {};

export type EditRouteTransforms = {
  type?: EditRouteProjectRoutesRequestType | undefined;
  op?: EditRouteOp | undefined;
  target?: EditRouteTarget | undefined;
  args?: any | undefined;
  env?: Array<string> | undefined;
};

export type EditRouteProjectRoutesRoute = {
  src: string;
  dest?: string | undefined;
  headers?: EditRouteHeaders | undefined;
  caseSensitive?: boolean | undefined;
  status?: number | undefined;
  has?: Array<EditRouteHas> | undefined;
  missing?: Array<EditRouteMissing> | undefined;
  transforms?: Array<EditRouteTransforms> | undefined;
  respectOriginCacheControl?: boolean | undefined;
};

/**
 * The full route object to replace the existing route with
 */
export type EditRouteRoute = {
  name: string;
  description?: string | undefined;
  enabled?: boolean | undefined;
  /**
   * Pattern syntax type. If not provided, inferred from pattern.
   */
  srcSyntax?: EditRouteSrcSyntax | undefined;
  route: EditRouteProjectRoutesRoute;
};

export type EditRouteRequestBody = {
  /**
   * The full route object to replace the existing route with
   */
  route?: EditRouteRoute | undefined;
  /**
   * If true, restores the staged route to the value in the production version.
   */
  restore?: boolean | undefined;
};

export type EditRouteRequest = {
  projectId: string;
  routeId: string;
  /**
   * The Team identifier to perform the request on behalf of.
   */
  teamId?: string | undefined;
  /**
   * The Team slug to perform the request on behalf of.
   */
  slug?: string | undefined;
  requestBody?: EditRouteRequestBody | undefined;
};

export const EditRouteRouteType = {
  Redirect: "redirect",
  Rewrite: "rewrite",
  SetStatus: "set_status",
  Transform: "transform",
} as const;
export type EditRouteRouteType = ClosedEnum<typeof EditRouteRouteType>;

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

export type EditRouteValueProjectRoutesEq = string | number;

export type EditRouteValueProjectRoutes2 = {
  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 EditRouteHasProjectRoutesValue =
  | string
  | EditRouteValueProjectRoutes2;

export type EditRouteHas2 = {
  type: EditRouteHasProjectRoutesType;
  key: string;
  value?: string | EditRouteValueProjectRoutes2 | undefined;
};

export type EditRouteValueEq = string | number;

export type EditRouteValue2 = {
  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 EditRouteHasValue = string | EditRouteValue2;

export type EditRouteHas1 = {
  type: "host";
  value: string | EditRouteValue2;
};

export type EditRouteProjectRoutesHas =
  | EditRouteHas1
  | (EditRouteHas2 & { type: "cookie" })
  | (EditRouteHas2 & { type: "header" })
  | (EditRouteHas2 & { type: "query" });

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

export type EditRouteValueProjectRoutesResponse200Eq = string | number;

export type EditRouteValueProjectRoutesResponse2002 = {
  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 EditRouteMissingProjectRoutesValue =
  | string
  | EditRouteValueProjectRoutesResponse2002;

export type EditRouteMissing2 = {
  type: EditRouteMissingProjectRoutesType;
  key: string;
  value?: string | EditRouteValueProjectRoutesResponse2002 | undefined;
};

export type EditRouteValueProjectRoutesResponseEq = string | number;

export type EditRouteValueProjectRoutesResponse2 = {
  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 EditRouteMissingValue =
  | string
  | EditRouteValueProjectRoutesResponse2;

export type EditRouteMissing1 = {
  type: "host";
  value: string | EditRouteValueProjectRoutesResponse2;
};

export type EditRouteProjectRoutesMissing =
  | EditRouteMissing1
  | (EditRouteMissing2 & { type: "cookie" })
  | (EditRouteMissing2 & { type: "header" })
  | (EditRouteMissing2 & { type: "query" });

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

export type EditRouteMitigate = {
  action: EditRouteAction;
};

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

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

export type EditRouteKeyEq = string | number;

export type EditRouteKey2 = {
  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 EditRouteKey = string | EditRouteKey2;

export type EditRouteProjectRoutesTarget = {
  key: string | EditRouteKey2;
};

export type EditRouteArgs = string | Array<string>;

export type EditRouteProjectRoutesTransforms = {
  type: EditRouteProjectRoutesResponseType;
  op: EditRouteProjectRoutesOp;
  target: EditRouteProjectRoutesTarget;
  args?: string | Array<string> | undefined;
  env?: Array<string> | undefined;
};

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

export const EditRouteDestinationType = {
  Service: "service",
} as const;
export type EditRouteDestinationType = ClosedEnum<
  typeof EditRouteDestinationType
>;

export type EditRouteDestination2 = {
  type: EditRouteDestinationType;
  service: string;
  /**
   * Routing-only path used to select a route inside the target service.
   */
  path?: string | undefined;
};

export type EditRouteDestination = EditRouteDestination2 | string;

/**
 * The route definition from @vercel/routing-utils.
 */
export type EditRouteProjectRoutesResponse200Route = {
  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<
      | EditRouteHas1
      | (EditRouteHas2 & { type: "cookie" })
      | (EditRouteHas2 & { type: "header" })
      | (EditRouteHas2 & { type: "query" })
    >
    | undefined;
  missing?:
    | Array<
      | EditRouteMissing1
      | (EditRouteMissing2 & { type: "cookie" })
      | (EditRouteMissing2 & { type: "header" })
      | (EditRouteMissing2 & { type: "query" })
    >
    | undefined;
  mitigate?: EditRouteMitigate | undefined;
  transforms?: Array<EditRouteProjectRoutesTransforms> | undefined;
  env?: Array<string> | undefined;
  locale?: EditRouteLocale | 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?: EditRouteDestination2 | 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;
};

/**
 * The syntax type of the source pattern. Determines how the pattern is compiled to regex.
 */
export const EditRouteProjectRoutesSrcSyntax = {
  Equals: "equals",
  PathToRegexp: "path-to-regexp",
  Regex: "regex",
} as const;
/**
 * The syntax type of the source pattern. Determines how the pattern is compiled to regex.
 */
export type EditRouteProjectRoutesSrcSyntax = ClosedEnum<
  typeof EditRouteProjectRoutesSrcSyntax
>;

export type EditRouteProjectRoutesResponseRoute = {
  routeType?: EditRouteRouteType | undefined;
  /**
   * Unique identifier for the routing rule.
   */
  id: string;
  /**
   * Human-readable name for the routing rule.
   */
  name: string;
  /**
   * Optional description of what the routing rule does.
   */
  description?: string | undefined;
  /**
   * Whether the routing rule is enabled. Defaults to true.
   */
  enabled?: boolean | undefined;
  /**
   * Whether this route is new and not yet published to production. Set to true only when a route is first created via add-route. Cleared (set to false) when a version is promoted to production.
   */
  staged?: boolean | undefined;
  /**
   * The route definition from @vercel/routing-utils.
   */
  route: EditRouteProjectRoutesResponse200Route;
  /**
   * Original source pattern provided by user (path-to-regexp or regex). Used to display the user's input in API responses.
   */
  rawSrc?: string | undefined;
  /**
   * Original destination provided by user.
   */
  rawDest?: string | undefined;
  /**
   * The syntax type of the source pattern. Determines how the pattern is compiled to regex.
   */
  srcSyntax?: EditRouteProjectRoutesSrcSyntax | undefined;
};

/**
 * A version of routing rules stored in S3.
 */
export type EditRouteVersion = {
  /**
   * Unique identifier for the version.
   */
  id: string;
  /**
   * The S3 key where the routing rules are stored.
   */
  s3Key: string;
  /**
   * Timestamp of when this version was last modified.
   */
  lastModified: number;
  /**
   * The user who created this version.
   */
  createdBy: string;
  /**
   * Whether this version is staged and not yet promoted to production.
   */
  isStaging?: boolean | undefined;
  /**
   * Whether this version is currently live in production.
   */
  isLive?: boolean | undefined;
  /**
   * The number of routing rules in this version.
   */
  ruleCount?: number | undefined;
  /**
   * The staging alias for previewing this version.
   */
  alias?: string | undefined;
};

export type EditRouteResponseBody = {
  route?: EditRouteProjectRoutesResponseRoute | undefined;
  /**
   * A version of routing rules stored in S3.
   */
  version: EditRouteVersion;
};

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

/** @internal */
export type EditRouteHeaders$Outbound = {};

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

export function editRouteHeadersToJSON(
  editRouteHeaders: EditRouteHeaders,
): string {
  return JSON.stringify(
    EditRouteHeaders$outboundSchema.parse(editRouteHeaders),
  );
}

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

/** @internal */
export type EditRouteHas$Outbound = {
  type?: string | undefined;
  key?: string | undefined;
  value?: string | undefined;
};

/** @internal */
export const EditRouteHas$outboundSchema: z.ZodType<
  EditRouteHas$Outbound,
  z.ZodTypeDef,
  EditRouteHas
> = z.object({
  type: EditRouteType$outboundSchema.optional(),
  key: z.string().optional(),
  value: z.string().optional(),
});

export function editRouteHasToJSON(editRouteHas: EditRouteHas): string {
  return JSON.stringify(EditRouteHas$outboundSchema.parse(editRouteHas));
}

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

/** @internal */
export type EditRouteMissing$Outbound = {
  type?: string | undefined;
  key?: string | undefined;
  value?: string | undefined;
};

/** @internal */
export const EditRouteMissing$outboundSchema: z.ZodType<
  EditRouteMissing$Outbound,
  z.ZodTypeDef,
  EditRouteMissing
> = z.object({
  type: EditRouteProjectRoutesType$outboundSchema.optional(),
  key: z.string().optional(),
  value: z.string().optional(),
});

export function editRouteMissingToJSON(
  editRouteMissing: EditRouteMissing,
): string {
  return JSON.stringify(
    EditRouteMissing$outboundSchema.parse(editRouteMissing),
  );
}

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

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

/** @internal */
export type EditRouteTarget$Outbound = {};

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

export function editRouteTargetToJSON(
  editRouteTarget: EditRouteTarget,
): string {
  return JSON.stringify(EditRouteTarget$outboundSchema.parse(editRouteTarget));
}

/** @internal */
export type EditRouteTransforms$Outbound = {
  type?: string | undefined;
  op?: string | undefined;
  target?: EditRouteTarget$Outbound | undefined;
  args?: any | undefined;
  env?: Array<string> | undefined;
};

/** @internal */
export const EditRouteTransforms$outboundSchema: z.ZodType<
  EditRouteTransforms$Outbound,
  z.ZodTypeDef,
  EditRouteTransforms
> = z.object({
  type: EditRouteProjectRoutesRequestType$outboundSchema.optional(),
  op: EditRouteOp$outboundSchema.optional(),
  target: z.lazy(() => EditRouteTarget$outboundSchema).optional(),
  args: z.any().optional(),
  env: z.array(z.string()).optional(),
});

export function editRouteTransformsToJSON(
  editRouteTransforms: EditRouteTransforms,
): string {
  return JSON.stringify(
    EditRouteTransforms$outboundSchema.parse(editRouteTransforms),
  );
}

/** @internal */
export type EditRouteProjectRoutesRoute$Outbound = {
  src: string;
  dest?: string | undefined;
  headers?: EditRouteHeaders$Outbound | undefined;
  caseSensitive?: boolean | undefined;
  status?: number | undefined;
  has?: Array<EditRouteHas$Outbound> | undefined;
  missing?: Array<EditRouteMissing$Outbound> | undefined;
  transforms?: Array<EditRouteTransforms$Outbound> | undefined;
  respectOriginCacheControl?: boolean | undefined;
};

/** @internal */
export const EditRouteProjectRoutesRoute$outboundSchema: z.ZodType<
  EditRouteProjectRoutesRoute$Outbound,
  z.ZodTypeDef,
  EditRouteProjectRoutesRoute
> = z.object({
  src: z.string(),
  dest: z.string().optional(),
  headers: z.lazy(() => EditRouteHeaders$outboundSchema).optional(),
  caseSensitive: z.boolean().optional(),
  status: z.number().int().optional(),
  has: z.array(z.lazy(() => EditRouteHas$outboundSchema)).optional(),
  missing: z.array(z.lazy(() => EditRouteMissing$outboundSchema)).optional(),
  transforms: z.array(z.lazy(() => EditRouteTransforms$outboundSchema))
    .optional(),
  respectOriginCacheControl: z.boolean().optional(),
});

export function editRouteProjectRoutesRouteToJSON(
  editRouteProjectRoutesRoute: EditRouteProjectRoutesRoute,
): string {
  return JSON.stringify(
    EditRouteProjectRoutesRoute$outboundSchema.parse(
      editRouteProjectRoutesRoute,
    ),
  );
}

/** @internal */
export type EditRouteRoute$Outbound = {
  name: string;
  description?: string | undefined;
  enabled?: boolean | undefined;
  srcSyntax?: string | undefined;
  route: EditRouteProjectRoutesRoute$Outbound;
};

/** @internal */
export const EditRouteRoute$outboundSchema: z.ZodType<
  EditRouteRoute$Outbound,
  z.ZodTypeDef,
  EditRouteRoute
> = z.object({
  name: z.string(),
  description: z.string().optional(),
  enabled: z.boolean().optional(),
  srcSyntax: EditRouteSrcSyntax$outboundSchema.optional(),
  route: z.lazy(() => EditRouteProjectRoutesRoute$outboundSchema),
});

export function editRouteRouteToJSON(editRouteRoute: EditRouteRoute): string {
  return JSON.stringify(EditRouteRoute$outboundSchema.parse(editRouteRoute));
}

/** @internal */
export type EditRouteRequestBody$Outbound = {
  route?: EditRouteRoute$Outbound | undefined;
  restore?: boolean | undefined;
};

/** @internal */
export const EditRouteRequestBody$outboundSchema: z.ZodType<
  EditRouteRequestBody$Outbound,
  z.ZodTypeDef,
  EditRouteRequestBody
> = z.object({
  route: z.lazy(() => EditRouteRoute$outboundSchema).optional(),
  restore: z.boolean().optional(),
});

export function editRouteRequestBodyToJSON(
  editRouteRequestBody: EditRouteRequestBody,
): string {
  return JSON.stringify(
    EditRouteRequestBody$outboundSchema.parse(editRouteRequestBody),
  );
}

/** @internal */
export type EditRouteRequest$Outbound = {
  projectId: string;
  routeId: string;
  teamId?: string | undefined;
  slug?: string | undefined;
  RequestBody?: EditRouteRequestBody$Outbound | undefined;
};

/** @internal */
export const EditRouteRequest$outboundSchema: z.ZodType<
  EditRouteRequest$Outbound,
  z.ZodTypeDef,
  EditRouteRequest
> = z.object({
  projectId: z.string(),
  routeId: z.string(),
  teamId: z.string().optional(),
  slug: z.string().optional(),
  requestBody: z.lazy(() => EditRouteRequestBody$outboundSchema).optional(),
}).transform((v) => {
  return remap$(v, {
    requestBody: "RequestBody",
  });
});

export function editRouteRequestToJSON(
  editRouteRequest: EditRouteRequest,
): string {
  return JSON.stringify(
    EditRouteRequest$outboundSchema.parse(editRouteRequest),
  );
}

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

/** @internal */
export const EditRouteProjectRoutesResponse200Route$inboundSchema: z.ZodType<
  EditRouteProjectRoutesResponse200Route,
  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(() => EditRouteHas1$inboundSchema),
      z.lazy(() =>
        EditRouteHas2$inboundSchema
      ).and(z.object({ type: z.literal("cookie") })),
      z.lazy(() => EditRouteHas2$inboundSchema).and(
        z.object({ type: z.literal("header") }),
      ),
      z.lazy(() => EditRouteHas2$inboundSchema).and(
        z.object({ type: z.literal("query") }),
      ),
    ])),
  ),
  missing: types.optional(
    z.array(z.union([
      z.lazy(() => EditRouteMissing1$inboundSchema),
      z.lazy(() =>
        EditRouteMissing2$inboundSchema
      ).and(z.object({ type: z.literal("cookie") })),
      z.lazy(() => EditRouteMissing2$inboundSchema).and(
        z.object({ type: z.literal("header") }),
      ),
      z.lazy(() => EditRouteMissing2$inboundSchema).and(
        z.object({ type: z.literal("query") }),
      ),
    ])),
  ),
  mitigate: types.optional(z.lazy(() => EditRouteMitigate$inboundSchema)),
  transforms: types.optional(
    z.array(z.lazy(() => EditRouteProjectRoutesTransforms$inboundSchema)),
  ),
  env: types.optional(z.array(types.string())),
  locale: types.optional(z.lazy(() => EditRouteLocale$inboundSchema)),
  source: types.optional(types.string()),
  destination: types.optional(
    smartUnion([
      z.lazy(() => EditRouteDestination2$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 editRouteProjectRoutesResponse200RouteFromJSON(
  jsonString: string,
): SafeParseResult<EditRouteProjectRoutesResponse200Route, SDKValidationError> {
  return safeParse(
    jsonString,
    (x) =>
      EditRouteProjectRoutesResponse200Route$inboundSchema.parse(JSON.parse(x)),
    `Failed to parse 'EditRouteProjectRoutesResponse200Route' from JSON`,
  );
}

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

/** @internal */
export const EditRouteProjectRoutesResponseRoute$inboundSchema: z.ZodType<
  EditRouteProjectRoutesResponseRoute,
  z.ZodTypeDef,
  unknown
> = z.object({
  routeType: types.optional(EditRouteRouteType$inboundSchema),
  id: types.string(),
  name: types.string(),
  description: types.optional(types.string()),
  enabled: types.optional(types.boolean()),
  staged: types.optional(types.boolean()),
  route: z.lazy(() => EditRouteProjectRoutesResponse200Route$inboundSchema),
  rawSrc: types.optional(types.string()),
  rawDest: types.optional(types.string()),
  srcSyntax: types.optional(EditRouteProjectRoutesSrcSyntax$inboundSchema),
});

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

/** @internal */
export const EditRouteVersion$inboundSchema: z.ZodType<
  EditRouteVersion,
  z.ZodTypeDef,
  unknown
> = z.object({
  id: types.string(),
  s3Key: types.string(),
  lastModified: types.number(),
  createdBy: types.string(),
  isStaging: types.optional(types.boolean()),
  isLive: types.optional(types.boolean()),
  ruleCount: types.optional(types.number()),
  alias: types.optional(types.string()),
});

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

/** @internal */
export const EditRouteResponseBody$inboundSchema: z.ZodType<
  EditRouteResponseBody,
  z.ZodTypeDef,
  unknown
> = z.object({
  route: types.optional(
    z.lazy(() => EditRouteProjectRoutesResponseRoute$inboundSchema),
  ),
  version: z.lazy(() => EditRouteVersion$inboundSchema),
});

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