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>

4,329 lines 129 kB
/*
 * 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";

export type ManagedRules = {};

export const PutFirewallConfigAction = {
  Deny: "deny",
  Log: "log",
} as const;
export type PutFirewallConfigAction = ClosedEnum<
  typeof PutFirewallConfigAction
>;

/**
 * Scanner Detection - Detect and prevent reconnaissance activities from network scanning tools.
 */
export type Sd = {
  active: boolean;
  action: PutFirewallConfigAction;
};

export const PutFirewallConfigSecurityAction = {
  Deny: "deny",
  Log: "log",
} as const;
export type PutFirewallConfigSecurityAction = ClosedEnum<
  typeof PutFirewallConfigSecurityAction
>;

/**
 * Multipart Attack - Block attempts to bypass security controls using multipart/form-data encoding.
 */
export type Ma = {
  active: boolean;
  action: PutFirewallConfigSecurityAction;
};

export const PutFirewallConfigSecurityRequestAction = {
  Deny: "deny",
  Log: "log",
} as const;
export type PutFirewallConfigSecurityRequestAction = ClosedEnum<
  typeof PutFirewallConfigSecurityRequestAction
>;

/**
 * Local File Inclusion Attack - Prevent unauthorized access to local files through web applications.
 */
export type Lfi = {
  active: boolean;
  action: PutFirewallConfigSecurityRequestAction;
};

export const PutFirewallConfigSecurityRequestRequestBodyAction = {
  Deny: "deny",
  Log: "log",
} as const;
export type PutFirewallConfigSecurityRequestRequestBodyAction = ClosedEnum<
  typeof PutFirewallConfigSecurityRequestRequestBodyAction
>;

/**
 * Remote File Inclusion Attack - Prohibit unauthorized upload or execution of remote files.
 */
export type Rfi = {
  active: boolean;
  action: PutFirewallConfigSecurityRequestRequestBodyAction;
};

export const PutFirewallConfigSecurityRequestRequestBodyCrsAction = {
  Deny: "deny",
  Log: "log",
} as const;
export type PutFirewallConfigSecurityRequestRequestBodyCrsAction = ClosedEnum<
  typeof PutFirewallConfigSecurityRequestRequestBodyCrsAction
>;

/**
 * Remote Execution Attack - Prevent unauthorized execution of remote scripts or commands.
 */
export type Rce = {
  active: boolean;
  action: PutFirewallConfigSecurityRequestRequestBodyCrsAction;
};

export const PutFirewallConfigSecurityRequestRequestBodyCrsPhpAction = {
  Deny: "deny",
  Log: "log",
} as const;
export type PutFirewallConfigSecurityRequestRequestBodyCrsPhpAction =
  ClosedEnum<typeof PutFirewallConfigSecurityRequestRequestBodyCrsPhpAction>;

/**
 * PHP Attack - Safeguard against vulnerability exploits in PHP-based applications.
 */
export type Php = {
  active: boolean;
  action: PutFirewallConfigSecurityRequestRequestBodyCrsPhpAction;
};

export const PutFirewallConfigSecurityRequestRequestBodyCrsGenAction = {
  Deny: "deny",
  Log: "log",
} as const;
export type PutFirewallConfigSecurityRequestRequestBodyCrsGenAction =
  ClosedEnum<typeof PutFirewallConfigSecurityRequestRequestBodyCrsGenAction>;

/**
 * Generic Attack - Provide broad protection from various undefined or novel attack vectors.
 */
export type Gen = {
  active: boolean;
  action: PutFirewallConfigSecurityRequestRequestBodyCrsGenAction;
};

export const PutFirewallConfigSecurityRequestRequestBodyCrsXssAction = {
  Deny: "deny",
  Log: "log",
} as const;
export type PutFirewallConfigSecurityRequestRequestBodyCrsXssAction =
  ClosedEnum<typeof PutFirewallConfigSecurityRequestRequestBodyCrsXssAction>;

/**
 * XSS Attack - Prevent injection of malicious scripts into trusted webpages.
 */
export type Xss = {
  active: boolean;
  action: PutFirewallConfigSecurityRequestRequestBodyCrsXssAction;
};

export const PutFirewallConfigSecurityRequestRequestBodyCrsSqliAction = {
  Deny: "deny",
  Log: "log",
} as const;
export type PutFirewallConfigSecurityRequestRequestBodyCrsSqliAction =
  ClosedEnum<typeof PutFirewallConfigSecurityRequestRequestBodyCrsSqliAction>;

/**
 * SQL Injection Attack - Prohibit unauthorized use of SQL commands to manipulate databases.
 */
export type Sqli = {
  active: boolean;
  action: PutFirewallConfigSecurityRequestRequestBodyCrsSqliAction;
};

export const PutFirewallConfigSecurityRequestRequestBodyCrsSfAction = {
  Deny: "deny",
  Log: "log",
} as const;
export type PutFirewallConfigSecurityRequestRequestBodyCrsSfAction = ClosedEnum<
  typeof PutFirewallConfigSecurityRequestRequestBodyCrsSfAction
>;

/**
 * Session Fixation Attack - Prevent unauthorized takeover of user sessions by enforcing unique session IDs.
 */
export type Sf = {
  active: boolean;
  action: PutFirewallConfigSecurityRequestRequestBodyCrsSfAction;
};

export const PutFirewallConfigSecurityRequestRequestBodyCrsJavaAction = {
  Deny: "deny",
  Log: "log",
} as const;
export type PutFirewallConfigSecurityRequestRequestBodyCrsJavaAction =
  ClosedEnum<typeof PutFirewallConfigSecurityRequestRequestBodyCrsJavaAction>;

/**
 * Java Attack - Mitigate risks of exploitation targeting Java-based applications or components.
 */
export type Java = {
  active: boolean;
  action: PutFirewallConfigSecurityRequestRequestBodyCrsJavaAction;
};

/**
 * Custom Ruleset
 */
export type Crs = {
  /**
   * Scanner Detection - Detect and prevent reconnaissance activities from network scanning tools.
   */
  sd?: Sd | undefined;
  /**
   * Multipart Attack - Block attempts to bypass security controls using multipart/form-data encoding.
   */
  ma?: Ma | undefined;
  /**
   * Local File Inclusion Attack - Prevent unauthorized access to local files through web applications.
   */
  lfi?: Lfi | undefined;
  /**
   * Remote File Inclusion Attack - Prohibit unauthorized upload or execution of remote files.
   */
  rfi?: Rfi | undefined;
  /**
   * Remote Execution Attack - Prevent unauthorized execution of remote scripts or commands.
   */
  rce?: Rce | undefined;
  /**
   * PHP Attack - Safeguard against vulnerability exploits in PHP-based applications.
   */
  php?: Php | undefined;
  /**
   * Generic Attack - Provide broad protection from various undefined or novel attack vectors.
   */
  gen?: Gen | undefined;
  /**
   * XSS Attack - Prevent injection of malicious scripts into trusted webpages.
   */
  xss?: Xss | undefined;
  /**
   * SQL Injection Attack - Prohibit unauthorized use of SQL commands to manipulate databases.
   */
  sqli?: Sqli | undefined;
  /**
   * Session Fixation Attack - Prevent unauthorized takeover of user sessions by enforcing unique session IDs.
   */
  sf?: Sf | undefined;
  /**
   * Java Attack - Mitigate risks of exploitation targeting Java-based applications or components.
   */
  java?: Java | undefined;
};

/**
 * [Parameter](https://vercel.com/docs/security/vercel-waf/rule-configuration#parameters) from the incoming traffic.
 */
export const PutFirewallConfigType = {
  Host: "host",
  Path: "path",
  Method: "method",
  Header: "header",
  Query: "query",
  Cookie: "cookie",
  TargetPath: "target_path",
  Route: "route",
  RawPath: "raw_path",
  IpAddress: "ip_address",
  Region: "region",
  Protocol: "protocol",
  Scheme: "scheme",
  Environment: "environment",
  DomainEnvironment: "domain_environment",
  UserAgent: "user_agent",
  GeoContinent: "geo_continent",
  GeoCountry: "geo_country",
  GeoCountryRegion: "geo_country_region",
  GeoCity: "geo_city",
  GeoAsNumber: "geo_as_number",
  Ja4Digest: "ja4_digest",
  Ja3Digest: "ja3_digest",
  RateLimitApiId: "rate_limit_api_id",
  ServerAction: "server_action",
  BotName: "bot_name",
  BotCategory: "bot_category",
  BotStatus: "bot_status",
  BotProtection: "bot_protection",
  SharedCondition: "shared_condition",
  TrafficSource: "traffic_source",
  Ruleset: "ruleset",
} as const;
/**
 * [Parameter](https://vercel.com/docs/security/vercel-waf/rule-configuration#parameters) from the incoming traffic.
 */
export type PutFirewallConfigType = ClosedEnum<typeof PutFirewallConfigType>;

export const PutFirewallConfigOp = {
  Re: "re",
  Eq: "eq",
  Neq: "neq",
  Ex: "ex",
  Nex: "nex",
  Inc: "inc",
  Ninc: "ninc",
  Pre: "pre",
  Suf: "suf",
  Sub: "sub",
  Gt: "gt",
  Gte: "gte",
  Lt: "lt",
  Lte: "lte",
  List: "list",
} as const;
export type PutFirewallConfigOp = ClosedEnum<typeof PutFirewallConfigOp>;

export type PutFirewallConfigValue = string | Array<string> | number;

export type PutFirewallConfigConditions = {
  /**
   * [Parameter](https://vercel.com/docs/security/vercel-waf/rule-configuration#parameters) from the incoming traffic.
   */
  type: PutFirewallConfigType;
  op: PutFirewallConfigOp;
  neg?: boolean | undefined;
  key?: string | undefined;
  value?: string | Array<string> | number | undefined;
};

export type ConditionGroup = {
  conditions: Array<PutFirewallConfigConditions>;
};

export const PutFirewallConfigSecurityRequestRequestBodyRulesActionAction = {
  Log: "log",
  Challenge: "challenge",
  Deny: "deny",
  Bypass: "bypass",
  RateLimit: "rate_limit",
  Redirect: "redirect",
} as const;
export type PutFirewallConfigSecurityRequestRequestBodyRulesActionAction =
  ClosedEnum<
    typeof PutFirewallConfigSecurityRequestRequestBodyRulesActionAction
  >;

export const Algo = {
  FixedWindow: "fixed_window",
  TokenBucket: "token_bucket",
} as const;
export type Algo = ClosedEnum<typeof Algo>;

export const Action1 = {
  Log: "log",
  Challenge: "challenge",
  Deny: "deny",
  RateLimit: "rate_limit",
} as const;
export type Action1 = ClosedEnum<typeof Action1>;

export type RateLimitAction = Action1 | any;

export type RateLimit1 = {
  algo: Algo;
  window: number;
  limit: number;
  keys: Array<string>;
  action?: Action1 | any | null | undefined;
};

export type RateLimit = RateLimit1 | any;

export type Redirect1 = {
  location: string;
  permanent: boolean;
};

export type PutFirewallConfigRedirect = Redirect1 | any;

export type LogHeaders = string | Array<string>;

export type Mitigate = {
  action: PutFirewallConfigSecurityRequestRequestBodyRulesActionAction;
  rateLimit?: RateLimit1 | any | null | undefined;
  redirect?: Redirect1 | any | null | undefined;
  actionDuration?: string | null | undefined;
  bypassSystem?: boolean | null | undefined;
  logHeaders?: string | Array<string> | undefined;
};

export type PutFirewallConfigSecurityRequestRequestBodyRulesAction = {
  mitigate?: Mitigate | undefined;
};

export type ValidationErrors = Array<string> | string;

export type PutFirewallConfigRules = {
  id?: string | undefined;
  name: string;
  description?: string | undefined;
  active: boolean;
  conditionGroup: Array<ConditionGroup>;
  action: PutFirewallConfigSecurityRequestRequestBodyRulesAction;
  valid?: boolean | undefined;
  validationErrors?: Array<string> | string | undefined;
};

export const PutFirewallConfigRulesetsSecurityAction = {
  Deny: "deny",
  Challenge: "challenge",
  Log: "log",
  Allow: "allow",
} as const;
export type PutFirewallConfigRulesetsSecurityAction = ClosedEnum<
  typeof PutFirewallConfigRulesetsSecurityAction
>;

export type Rulesets2 = {
  action: PutFirewallConfigRulesetsSecurityAction;
};

export const RulesetsType = {
  Host: "host",
  Path: "path",
  Method: "method",
  Header: "header",
  Query: "query",
  Cookie: "cookie",
  TargetPath: "target_path",
  Route: "route",
  RawPath: "raw_path",
  IpAddress: "ip_address",
  Region: "region",
  Protocol: "protocol",
  Scheme: "scheme",
  Environment: "environment",
  DomainEnvironment: "domain_environment",
  UserAgent: "user_agent",
  GeoContinent: "geo_continent",
  GeoCountry: "geo_country",
  GeoCountryRegion: "geo_country_region",
  GeoCity: "geo_city",
  GeoAsNumber: "geo_as_number",
  Ja4Digest: "ja4_digest",
  Ja3Digest: "ja3_digest",
  RateLimitApiId: "rate_limit_api_id",
  ServerAction: "server_action",
  BotName: "bot_name",
  BotCategory: "bot_category",
  BotStatus: "bot_status",
  BotProtection: "bot_protection",
  SharedCondition: "shared_condition",
  TrafficSource: "traffic_source",
  Ruleset: "ruleset",
} as const;
export type RulesetsType = ClosedEnum<typeof RulesetsType>;

export const RulesetsOp = {
  Re: "re",
  Eq: "eq",
  Neq: "neq",
  Ex: "ex",
  Nex: "nex",
  Inc: "inc",
  Ninc: "ninc",
  Pre: "pre",
  Suf: "suf",
  Sub: "sub",
  Gt: "gt",
  Gte: "gte",
  Lt: "lt",
  Lte: "lte",
  List: "list",
} as const;
export type RulesetsOp = ClosedEnum<typeof RulesetsOp>;

export type RulesetsValue = string | Array<string> | number;

export type RulesetsConditions = {
  type: RulesetsType;
  op: RulesetsOp;
  neg?: boolean | undefined;
  key?: string | undefined;
  value?: string | Array<string> | number | undefined;
};

export type RulesetsConditionGroup = {
  conditions: Array<RulesetsConditions>;
};

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

export type RulesetsMitigate = {
  action: PutFirewallConfigRulesetsAction;
};

export type RulesetsAction = {
  mitigate?: RulesetsMitigate | undefined;
};

export type RulesetsValidationErrors = Array<string> | string;

export type Rulesets1 = {
  id?: string | undefined;
  name: string;
  description?: string | undefined;
  active: boolean;
  conditionGroup: Array<RulesetsConditionGroup>;
  action?: RulesetsAction | undefined;
  valid?: boolean | undefined;
  validationErrors?: Array<string> | string | undefined;
};

export type Rulesets = Array<Rulesets1> | { [k: string]: Rulesets2 };

export const PutFirewallConfigSecurityRequestRequestBodyIpsAction = {
  Deny: "deny",
  Challenge: "challenge",
  Log: "log",
  Bypass: "bypass",
} as const;
export type PutFirewallConfigSecurityRequestRequestBodyIpsAction = ClosedEnum<
  typeof PutFirewallConfigSecurityRequestRequestBodyIpsAction
>;

export type Ips = {
  id?: string | undefined;
  hostname: string;
  ip: string;
  notes?: string | undefined;
  action: PutFirewallConfigSecurityRequestRequestBodyIpsAction;
};

export type PutFirewallConfigLogHeaders = string | Array<string>;

export type PutFirewallConfigRequestBody = {
  firewallEnabled: boolean;
  managedRules?: ManagedRules | undefined;
  /**
   * Custom Ruleset
   */
  crs?: Crs | undefined;
  rules?: Array<PutFirewallConfigRules> | undefined;
  rulesets?: Array<Rulesets1> | { [k: string]: Rulesets2 } | undefined;
  ips?: Array<Ips> | undefined;
  botIdEnabled?: boolean | undefined;
  logHeaders?: string | Array<string> | undefined;
};

export type PutFirewallConfigRequest = {
  projectId: 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: PutFirewallConfigRequestBody;
};

export const PutFirewallConfigSecurityResponse200ApplicationJSONResponseBodyActiveCrsSdAction =
  {
    Deny: "deny",
    Log: "log",
  } as const;
export type PutFirewallConfigSecurityResponse200ApplicationJSONResponseBodyActiveCrsSdAction =
  ClosedEnum<
    typeof PutFirewallConfigSecurityResponse200ApplicationJSONResponseBodyActiveCrsSdAction
  >;

/**
 * Scanner Detection - Detect and prevent reconnaissance activities from network scanning tools.
 */
export type PutFirewallConfigSd = {
  active: boolean;
  action:
    PutFirewallConfigSecurityResponse200ApplicationJSONResponseBodyActiveCrsSdAction;
};

export const PutFirewallConfigSecurityResponse200Action = {
  Deny: "deny",
  Log: "log",
} as const;
export type PutFirewallConfigSecurityResponse200Action = ClosedEnum<
  typeof PutFirewallConfigSecurityResponse200Action
>;

/**
 * Multipart Attack - Block attempts to bypass security controls using multipart/form-data encoding.
 */
export type PutFirewallConfigMa = {
  active: boolean;
  action: PutFirewallConfigSecurityResponse200Action;
};

export const PutFirewallConfigSecurityResponse200ApplicationJSONAction = {
  Deny: "deny",
  Log: "log",
} as const;
export type PutFirewallConfigSecurityResponse200ApplicationJSONAction =
  ClosedEnum<typeof PutFirewallConfigSecurityResponse200ApplicationJSONAction>;

/**
 * Local File Inclusion Attack - Prevent unauthorized access to local files through web applications.
 */
export type PutFirewallConfigLfi = {
  active: boolean;
  action: PutFirewallConfigSecurityResponse200ApplicationJSONAction;
};

export const PutFirewallConfigSecurityResponse200ApplicationJSONResponseBodyAction =
  {
    Deny: "deny",
    Log: "log",
  } as const;
export type PutFirewallConfigSecurityResponse200ApplicationJSONResponseBodyAction =
  ClosedEnum<
    typeof PutFirewallConfigSecurityResponse200ApplicationJSONResponseBodyAction
  >;

/**
 * Remote File Inclusion Attack - Prohibit unauthorized upload or execution of remote files.
 */
export type PutFirewallConfigRfi = {
  active: boolean;
  action: PutFirewallConfigSecurityResponse200ApplicationJSONResponseBodyAction;
};

export const PutFirewallConfigSecurityResponse200ApplicationJSONResponseBodyActiveAction =
  {
    Deny: "deny",
    Log: "log",
  } as const;
export type PutFirewallConfigSecurityResponse200ApplicationJSONResponseBodyActiveAction =
  ClosedEnum<
    typeof PutFirewallConfigSecurityResponse200ApplicationJSONResponseBodyActiveAction
  >;

/**
 * Remote Execution Attack - Prevent unauthorized execution of remote scripts or commands.
 */
export type PutFirewallConfigRce = {
  active: boolean;
  action:
    PutFirewallConfigSecurityResponse200ApplicationJSONResponseBodyActiveAction;
};

export const PutFirewallConfigSecurityResponse200ApplicationJSONResponseBodyActiveCrsAction =
  {
    Deny: "deny",
    Log: "log",
  } as const;
export type PutFirewallConfigSecurityResponse200ApplicationJSONResponseBodyActiveCrsAction =
  ClosedEnum<
    typeof PutFirewallConfigSecurityResponse200ApplicationJSONResponseBodyActiveCrsAction
  >;

/**
 * PHP Attack - Safeguard against vulnerability exploits in PHP-based applications.
 */
export type PutFirewallConfigPhp = {
  active: boolean;
  action:
    PutFirewallConfigSecurityResponse200ApplicationJSONResponseBodyActiveCrsAction;
};

export const PutFirewallConfigSecurityResponse200ApplicationJSONResponseBodyActiveCrsGenAction =
  {
    Deny: "deny",
    Log: "log",
  } as const;
export type PutFirewallConfigSecurityResponse200ApplicationJSONResponseBodyActiveCrsGenAction =
  ClosedEnum<
    typeof PutFirewallConfigSecurityResponse200ApplicationJSONResponseBodyActiveCrsGenAction
  >;

/**
 * Generic Attack - Provide broad protection from various undefined or novel attack vectors.
 */
export type PutFirewallConfigGen = {
  active: boolean;
  action:
    PutFirewallConfigSecurityResponse200ApplicationJSONResponseBodyActiveCrsGenAction;
};

export const PutFirewallConfigSecurityResponse200ApplicationJSONResponseBodyActiveCrsXssAction =
  {
    Deny: "deny",
    Log: "log",
  } as const;
export type PutFirewallConfigSecurityResponse200ApplicationJSONResponseBodyActiveCrsXssAction =
  ClosedEnum<
    typeof PutFirewallConfigSecurityResponse200ApplicationJSONResponseBodyActiveCrsXssAction
  >;

/**
 * XSS Attack - Prevent injection of malicious scripts into trusted webpages.
 */
export type PutFirewallConfigXss = {
  active: boolean;
  action:
    PutFirewallConfigSecurityResponse200ApplicationJSONResponseBodyActiveCrsXssAction;
};

export const PutFirewallConfigSecurityResponse200ApplicationJSONResponseBodyActiveCrsSqliAction =
  {
    Deny: "deny",
    Log: "log",
  } as const;
export type PutFirewallConfigSecurityResponse200ApplicationJSONResponseBodyActiveCrsSqliAction =
  ClosedEnum<
    typeof PutFirewallConfigSecurityResponse200ApplicationJSONResponseBodyActiveCrsSqliAction
  >;

/**
 * SQL Injection Attack - Prohibit unauthorized use of SQL commands to manipulate databases.
 */
export type PutFirewallConfigSqli = {
  active: boolean;
  action:
    PutFirewallConfigSecurityResponse200ApplicationJSONResponseBodyActiveCrsSqliAction;
};

export const PutFirewallConfigSecurityResponse200ApplicationJSONResponseBodyActiveCrsSfAction =
  {
    Deny: "deny",
    Log: "log",
  } as const;
export type PutFirewallConfigSecurityResponse200ApplicationJSONResponseBodyActiveCrsSfAction =
  ClosedEnum<
    typeof PutFirewallConfigSecurityResponse200ApplicationJSONResponseBodyActiveCrsSfAction
  >;

/**
 * Session Fixation Attack - Prevent unauthorized takeover of user sessions by enforcing unique session IDs.
 */
export type PutFirewallConfigSf = {
  active: boolean;
  action:
    PutFirewallConfigSecurityResponse200ApplicationJSONResponseBodyActiveCrsSfAction;
};

export const PutFirewallConfigSecurityResponse200ApplicationJSONResponseBodyActiveCrsJavaAction =
  {
    Deny: "deny",
    Log: "log",
  } as const;
export type PutFirewallConfigSecurityResponse200ApplicationJSONResponseBodyActiveCrsJavaAction =
  ClosedEnum<
    typeof PutFirewallConfigSecurityResponse200ApplicationJSONResponseBodyActiveCrsJavaAction
  >;

/**
 * Java Attack - Mitigate risks of exploitation targeting Java-based applications or components.
 */
export type PutFirewallConfigJava = {
  active: boolean;
  action:
    PutFirewallConfigSecurityResponse200ApplicationJSONResponseBodyActiveCrsJavaAction;
};

/**
 * Custom Ruleset
 */
export type PutFirewallConfigCrs = {
  /**
   * Scanner Detection - Detect and prevent reconnaissance activities from network scanning tools.
   */
  sd: PutFirewallConfigSd;
  /**
   * Multipart Attack - Block attempts to bypass security controls using multipart/form-data encoding.
   */
  ma: PutFirewallConfigMa;
  /**
   * Local File Inclusion Attack - Prevent unauthorized access to local files through web applications.
   */
  lfi: PutFirewallConfigLfi;
  /**
   * Remote File Inclusion Attack - Prohibit unauthorized upload or execution of remote files.
   */
  rfi: PutFirewallConfigRfi;
  /**
   * Remote Execution Attack - Prevent unauthorized execution of remote scripts or commands.
   */
  rce: PutFirewallConfigRce;
  /**
   * PHP Attack - Safeguard against vulnerability exploits in PHP-based applications.
   */
  php: PutFirewallConfigPhp;
  /**
   * Generic Attack - Provide broad protection from various undefined or novel attack vectors.
   */
  gen: PutFirewallConfigGen;
  /**
   * XSS Attack - Prevent injection of malicious scripts into trusted webpages.
   */
  xss: PutFirewallConfigXss;
  /**
   * SQL Injection Attack - Prohibit unauthorized use of SQL commands to manipulate databases.
   */
  sqli: PutFirewallConfigSqli;
  /**
   * Session Fixation Attack - Prevent unauthorized takeover of user sessions by enforcing unique session IDs.
   */
  sf: PutFirewallConfigSf;
  /**
   * Java Attack - Mitigate risks of exploitation targeting Java-based applications or components.
   */
  java: PutFirewallConfigJava;
};

export const PutFirewallConfigRulesSecurityType = {
  BotCategory: "bot_category",
  BotName: "bot_name",
  BotProtection: "bot_protection",
  BotStatus: "bot_status",
  Cookie: "cookie",
  DomainEnvironment: "domain_environment",
  Environment: "environment",
  GeoAsNumber: "geo_as_number",
  GeoCity: "geo_city",
  GeoContinent: "geo_continent",
  GeoCountry: "geo_country",
  GeoCountryRegion: "geo_country_region",
  Header: "header",
  Host: "host",
  IpAddress: "ip_address",
  Ja3Digest: "ja3_digest",
  Ja4Digest: "ja4_digest",
  Method: "method",
  Path: "path",
  Protocol: "protocol",
  Query: "query",
  RateLimitApiId: "rate_limit_api_id",
  RawPath: "raw_path",
  Region: "region",
  Route: "route",
  Ruleset: "ruleset",
  Scheme: "scheme",
  ServerAction: "server_action",
  SharedCondition: "shared_condition",
  TargetPath: "target_path",
  TrafficSource: "traffic_source",
  TrustedSource: "trusted_source",
  UserAgent: "user_agent",
} as const;
export type PutFirewallConfigRulesSecurityType = ClosedEnum<
  typeof PutFirewallConfigRulesSecurityType
>;

export const PutFirewallConfigRulesSecurityOp = {
  Eq: "eq",
  Ex: "ex",
  Gt: "gt",
  Gte: "gte",
  Inc: "inc",
  List: "list",
  Lt: "lt",
  Lte: "lte",
  Neq: "neq",
  Nex: "nex",
  Ninc: "ninc",
  Pre: "pre",
  Re: "re",
  Sub: "sub",
  Suf: "suf",
} as const;
export type PutFirewallConfigRulesSecurityOp = ClosedEnum<
  typeof PutFirewallConfigRulesSecurityOp
>;

export type PutFirewallConfigRulesSecurityValue =
  | string
  | number
  | Array<string>;

export type PutFirewallConfigRulesSecurityConditions = {
  type: PutFirewallConfigRulesSecurityType;
  op: PutFirewallConfigRulesSecurityOp;
  neg?: boolean | undefined;
  key?: string | undefined;
  value?: string | number | Array<string> | undefined;
};

export type PutFirewallConfigRulesSecurityConditionGroup = {
  conditions: Array<PutFirewallConfigRulesSecurityConditions>;
};

export const PutFirewallConfigRulesSecurityResponseAction = {
  Allow: "allow",
  Bypass: "bypass",
  Challenge: "challenge",
  Deny: "deny",
  Log: "log",
  RateLimit: "rate_limit",
  Redirect: "redirect",
} as const;
export type PutFirewallConfigRulesSecurityResponseAction = ClosedEnum<
  typeof PutFirewallConfigRulesSecurityResponseAction
>;

export const PutFirewallConfigRulesSecurityAlgo = {
  FixedWindow: "fixed_window",
  TokenBucket: "token_bucket",
} as const;
export type PutFirewallConfigRulesSecurityAlgo = ClosedEnum<
  typeof PutFirewallConfigRulesSecurityAlgo
>;

export const PutFirewallConfigRulesSecurityResponse200ApplicationJSONAction = {
  Challenge: "challenge",
  Deny: "deny",
  Log: "log",
  RateLimit: "rate_limit",
} as const;
export type PutFirewallConfigRulesSecurityResponse200ApplicationJSONAction =
  ClosedEnum<
    typeof PutFirewallConfigRulesSecurityResponse200ApplicationJSONAction
  >;

export type PutFirewallConfigRulesSecurityRateLimit = {
  algo: PutFirewallConfigRulesSecurityAlgo;
  window: number;
  limit: number;
  keys: Array<string>;
  action?:
    | PutFirewallConfigRulesSecurityResponse200ApplicationJSONAction
    | null
    | undefined;
};

export type PutFirewallConfigRulesSecurityRedirect = {
  location: string;
  permanent: boolean;
};

export const PutFirewallConfigLogHeadersSecurityResponse200ApplicationJson2 = {
  Wildcard: "*",
} as const;
export type PutFirewallConfigLogHeadersSecurityResponse200ApplicationJson2 =
  ClosedEnum<
    typeof PutFirewallConfigLogHeadersSecurityResponse200ApplicationJson2
  >;

export type PutFirewallConfigRulesSecurityLogHeaders =
  | Array<string>
  | PutFirewallConfigLogHeadersSecurityResponse200ApplicationJson2;

export type PutFirewallConfigRulesSecurityMitigate = {
  action: PutFirewallConfigRulesSecurityResponseAction;
  rateLimit?: PutFirewallConfigRulesSecurityRateLimit | null | undefined;
  redirect?: PutFirewallConfigRulesSecurityRedirect | null | undefined;
  actionDuration?: string | null | undefined;
  bypassSystem?: boolean | null | undefined;
  logHeaders?:
    | Array<string>
    | PutFirewallConfigLogHeadersSecurityResponse200ApplicationJson2
    | undefined;
};

export type PutFirewallConfigRulesSecurityAction = {
  mitigate?: PutFirewallConfigRulesSecurityMitigate | undefined;
};

export type PutFirewallConfigRules2 = {
  id: string;
  name: string;
  description?: string | undefined;
  active: boolean;
  conditionGroup: Array<PutFirewallConfigRulesSecurityConditionGroup>;
  action: PutFirewallConfigRulesSecurityAction;
  valid: false;
  validationErrors: Array<string>;
};

export const PutFirewallConfigRulesType = {
  BotCategory: "bot_category",
  BotName: "bot_name",
  BotProtection: "bot_protection",
  BotStatus: "bot_status",
  Cookie: "cookie",
  DomainEnvironment: "domain_environment",
  Environment: "environment",
  GeoAsNumber: "geo_as_number",
  GeoCity: "geo_city",
  GeoContinent: "geo_continent",
  GeoCountry: "geo_country",
  GeoCountryRegion: "geo_country_region",
  Header: "header",
  Host: "host",
  IpAddress: "ip_address",
  Ja3Digest: "ja3_digest",
  Ja4Digest: "ja4_digest",
  Method: "method",
  Path: "path",
  Protocol: "protocol",
  Query: "query",
  RateLimitApiId: "rate_limit_api_id",
  RawPath: "raw_path",
  Region: "region",
  Route: "route",
  Ruleset: "ruleset",
  Scheme: "scheme",
  ServerAction: "server_action",
  SharedCondition: "shared_condition",
  TargetPath: "target_path",
  TrafficSource: "traffic_source",
  TrustedSource: "trusted_source",
  UserAgent: "user_agent",
} as const;
export type PutFirewallConfigRulesType = ClosedEnum<
  typeof PutFirewallConfigRulesType
>;

export const PutFirewallConfigRulesOp = {
  Eq: "eq",
  Ex: "ex",
  Gt: "gt",
  Gte: "gte",
  Inc: "inc",
  List: "list",
  Lt: "lt",
  Lte: "lte",
  Neq: "neq",
  Nex: "nex",
  Ninc: "ninc",
  Pre: "pre",
  Re: "re",
  Sub: "sub",
  Suf: "suf",
} as const;
export type PutFirewallConfigRulesOp = ClosedEnum<
  typeof PutFirewallConfigRulesOp
>;

export type PutFirewallConfigRulesValue = string | number | Array<string>;

export type PutFirewallConfigRulesConditions = {
  type: PutFirewallConfigRulesType;
  op: PutFirewallConfigRulesOp;
  neg?: boolean | undefined;
  key?: string | undefined;
  value?: string | number | Array<string> | undefined;
};

export type PutFirewallConfigRulesConditionGroup = {
  conditions: Array<PutFirewallConfigRulesConditions>;
};

export const PutFirewallConfigRulesSecurityResponse200Action = {
  Allow: "allow",
  Bypass: "bypass",
  Challenge: "challenge",
  Deny: "deny",
  Log: "log",
  RateLimit: "rate_limit",
  Redirect: "redirect",
} as const;
export type PutFirewallConfigRulesSecurityResponse200Action = ClosedEnum<
  typeof PutFirewallConfigRulesSecurityResponse200Action
>;

export const PutFirewallConfigRulesAlgo = {
  FixedWindow: "fixed_window",
  TokenBucket: "token_bucket",
} as const;
export type PutFirewallConfigRulesAlgo = ClosedEnum<
  typeof PutFirewallConfigRulesAlgo
>;

export const PutFirewallConfigRulesSecurityResponse200ApplicationJSONResponseBodyAction =
  {
    Challenge: "challenge",
    Deny: "deny",
    Log: "log",
    RateLimit: "rate_limit",
  } as const;
export type PutFirewallConfigRulesSecurityResponse200ApplicationJSONResponseBodyAction =
  ClosedEnum<
    typeof PutFirewallConfigRulesSecurityResponse200ApplicationJSONResponseBodyAction
  >;

export type PutFirewallConfigRulesRateLimit = {
  algo: PutFirewallConfigRulesAlgo;
  window: number;
  limit: number;
  keys: Array<string>;
  action?:
    | PutFirewallConfigRulesSecurityResponse200ApplicationJSONResponseBodyAction
    | null
    | undefined;
};

export type PutFirewallConfigRulesRedirect = {
  location: string;
  permanent: boolean;
};

export const PutFirewallConfigLogHeadersSecurityResponse2002 = {
  Wildcard: "*",
} as const;
export type PutFirewallConfigLogHeadersSecurityResponse2002 = ClosedEnum<
  typeof PutFirewallConfigLogHeadersSecurityResponse2002
>;

export type PutFirewallConfigRulesLogHeaders =
  | Array<string>
  | PutFirewallConfigLogHeadersSecurityResponse2002;

export type PutFirewallConfigRulesMitigate = {
  action: PutFirewallConfigRulesSecurityResponse200Action;
  rateLimit?: PutFirewallConfigRulesRateLimit | null | undefined;
  redirect?: PutFirewallConfigRulesRedirect | null | undefined;
  actionDuration?: string | null | undefined;
  bypassSystem?: boolean | null | undefined;
  logHeaders?:
    | Array<string>
    | PutFirewallConfigLogHeadersSecurityResponse2002
    | undefined;
};

export type PutFirewallConfigRulesAction = {
  mitigate?: PutFirewallConfigRulesMitigate | undefined;
};

export type PutFirewallConfigRules1 = {
  id: string;
  name: string;
  description?: string | undefined;
  active: boolean;
  conditionGroup: Array<PutFirewallConfigRulesConditionGroup>;
  action: PutFirewallConfigRulesAction;
  valid: true;
  validationErrors?: any | null | undefined;
};

export type PutFirewallConfigSecurityRules =
  | PutFirewallConfigRules1
  | PutFirewallConfigRules2;

export const PutFirewallConfigSecurityResponseAction = {
  Bypass: "bypass",
  Challenge: "challenge",
  Deny: "deny",
  Log: "log",
} as const;
export type PutFirewallConfigSecurityResponseAction = ClosedEnum<
  typeof PutFirewallConfigSecurityResponseAction
>;

export type PutFirewallConfigIps = {
  id: string;
  hostname: string;
  ip: string;
  notes?: string | undefined;
  action: PutFirewallConfigSecurityResponseAction;
};

export const PutFirewallConfigRulesetsSecurityResponse200Action = {
  Allow: "allow",
  Bypass: "bypass",
  Challenge: "challenge",
  Deny: "deny",
  Log: "log",
  RateLimit: "rate_limit",
  Redirect: "redirect",
} as const;
export type PutFirewallConfigRulesetsSecurityResponse200Action = ClosedEnum<
  typeof PutFirewallConfigRulesetsSecurityResponse200Action
>;

export const PutFirewallConfigRulesetsAlgo = {
  FixedWindow: "fixed_window",
  TokenBucket: "token_bucket",
} as const;
export type PutFirewallConfigRulesetsAlgo = ClosedEnum<
  typeof PutFirewallConfigRulesetsAlgo
>;

export const PutFirewallConfigRulesetsSecurityResponse200ApplicationJSONAction =
  {
    Challenge: "challenge",
    Deny: "deny",
    Log: "log",
    RateLimit: "rate_limit",
  } as const;
export type PutFirewallConfigRulesetsSecurityResponse200ApplicationJSONAction =
  ClosedEnum<
    typeof PutFirewallConfigRulesetsSecurityResponse200ApplicationJSONAction
  >;

export type PutFirewallConfigRulesetsRateLimit = {
  algo: PutFirewallConfigRulesetsAlgo;
  window: number;
  limit: number;
  keys: Array<string>;
  action?:
    | PutFirewallConfigRulesetsSecurityResponse200ApplicationJSONAction
    | null
    | undefined;
};

export type PutFirewallConfigRulesetsRedirect = {
  location: string;
  permanent: boolean;
};

export const PutFirewallConfigLogHeadersSecurity2 = {
  Wildcard: "*",
} as const;
export type PutFirewallConfigLogHeadersSecurity2 = ClosedEnum<
  typeof PutFirewallConfigLogHeadersSecurity2
>;

export type PutFirewallConfigRulesetsLogHeaders =
  | Array<string>
  | PutFirewallConfigLogHeadersSecurity2;

export type PutFirewallConfigRulesets2 = {
  action: PutFirewallConfigRulesetsSecurityResponse200Action;
  rateLimit?: PutFirewallConfigRulesetsRateLimit | null | undefined;
  redirect?: PutFirewallConfigRulesetsRedirect | null | undefined;
  actionDuration?: string | null | undefined;
  bypassSystem?: boolean | null | undefined;
  logHeaders?: Array<string> | PutFirewallConfigLogHeadersSecurity2 | undefined;
};

export const PutFirewallConfigRulesetsType = {
  BotCategory: "bot_category",
  BotName: "bot_name",
  BotProtection: "bot_protection",
  BotStatus: "bot_status",
  Cookie: "cookie",
  DomainEnvironment: "domain_environment",
  Environment: "environment",
  GeoAsNumber: "geo_as_number",
  GeoCity: "geo_city",
  GeoContinent: "geo_continent",
  GeoCountry: "geo_country",
  GeoCountryRegion: "geo_country_region",
  Header: "header",
  Host: "host",
  IpAddress: "ip_address",
  Ja3Digest: "ja3_digest",
  Ja4Digest: "ja4_digest",
  Method: "method",
  Path: "path",
  Protocol: "protocol",
  Query: "query",
  RateLimitApiId: "rate_limit_api_id",
  RawPath: "raw_path",
  Region: "region",
  Route: "route",
  Ruleset: "ruleset",
  Scheme: "scheme",
  ServerAction: "server_action",
  SharedCondition: "shared_condition",
  TargetPath: "target_path",
  TrafficSource: "traffic_source",
  TrustedSource: "trusted_source",
  UserAgent: "user_agent",
} as const;
export type PutFirewallConfigRulesetsType = ClosedEnum<
  typeof PutFirewallConfigRulesetsType
>;

export const PutFirewallConfigRulesetsOp = {
  Eq: "eq",
  Ex: "ex",
  Gt: "gt",
  Gte: "gte",
  Inc: "inc",
  List: "list",
  Lt: "lt",
  Lte: "lte",
  Neq: "neq",
  Nex: "nex",
  Ninc: "ninc",
  Pre: "pre",
  Re: "re",
  Sub: "sub",
  Suf: "suf",
} as const;
export type PutFirewallConfigRulesetsOp = ClosedEnum<
  typeof PutFirewallConfigRulesetsOp
>;

export type PutFirewallConfigRulesetsValue = string | number | Array<string>;

export type PutFirewallConfigRulesetsConditions = {
  type: PutFirewallConfigRulesetsType;
  op: PutFirewallConfigRulesetsOp;
  neg?: boolean | undefined;
  key?: string | undefined;
  value?: string | number | Array<string> | undefined;
};

export type PutFirewallConfigRulesetsConditionGroup = {
  conditions: Array<PutFirewallConfigRulesetsConditions>;
};

export const PutFirewallConfigRulesetsSecurityResponse200ApplicationJSONResponseBodyAction =
  {
    Allow: "allow",
    Bypass: "bypass",
    Challenge: "challenge",
    Deny: "deny",
    Log: "log",
    RateLimit: "rate_limit",
    Redirect: "redirect",
  } as const;
export type PutFirewallConfigRulesetsSecurityResponse200ApplicationJSONResponseBodyAction =
  ClosedEnum<
    typeof PutFirewallConfigRulesetsSecurityResponse200ApplicationJSONResponseBodyAction
  >;

export const PutFirewallConfigRulesetsSecurityAlgo = {
  FixedWindow: "fixed_window",
  TokenBucket: "token_bucket",
} as const;
export type PutFirewallConfigRulesetsSecurityAlgo = ClosedEnum<
  typeof PutFirewallConfigRulesetsSecurityAlgo
>;

export const PutFirewallConfigRulesetsSecurityResponse200ApplicationJSONResponseBodyActiveAction =
  {
    Challenge: "challenge",
    Deny: "deny",
    Log: "log",
    RateLimit: "rate_limit",
  } as const;
export type PutFirewallConfigRulesetsSecurityResponse200ApplicationJSONResponseBodyActiveAction =
  ClosedEnum<
    typeof PutFirewallConfigRulesetsSecurityResponse200ApplicationJSONResponseBodyActiveAction
  >;

export type PutFirewallConfigRulesetsSecurityRateLimit = {
  algo: PutFirewallConfigRulesetsSecurityAlgo;
  window: number;
  limit: number;
  keys: Array<string>;
  action?:
    | PutFirewallConfigRulesetsSecurityResponse200ApplicationJSONResponseBodyActiveAction
    | null
    | undefined;
};

export type PutFirewallConfigRulesetsSecurityRedirect = {
  location: string;
  permanent: boolean;
};

export const PutFirewallConfigLogHeadersSecurityResponse2 = {
  Wildcard: "*",
} as const;
export type PutFirewallConfigLogHeadersSecurityResponse2 = ClosedEnum<
  typeof PutFirewallConfigLogHeadersSecurityResponse2
>;

export type PutFirewallConfigRulesetsSecurityLogHeaders =
  | Array<string>
  | PutFirewallConfigLogHeadersSecurityResponse2;

export type PutFirewallConfigRulesetsMitigate = {
  action:
    PutFirewallConfigRulesetsSecurityResponse200ApplicationJSONResponseBodyAction;
  rateLimit?: PutFirewallConfigRulesetsSecurityRateLimit | null | undefined;
  redirect?: PutFirewallConfigRulesetsSecurityRedirect | null | undefined;
  actionDuration?: string | null | undefined;
  bypassSystem?: boolean | null | undefined;
  logHeaders?:
    | Array<string>
    | PutFirewallConfigLogHeadersSecurityResponse2
    | undefined;
};

export type PutFirewallConfigRulesetsSecurityResponseAction = {
  mitigate?: PutFirewallConfigRulesetsMitigate | undefined;
};

export type PutFirewallConfigRulesets1 = {
  description?: string | undefined;
  id: string;
  name: string;
  active: boolean;
  conditionGroup: Array<PutFirewallConfigRulesetsConditionGroup>;
  action?: PutFirewallConfigRulesetsSecurityResponseAction | undefined;
};

export type PutFirewallConfigRulesets = Array<PutFirewallConfigRulesets1> | {
  [k: string]: PutFirewallConfigRulesets2;
};

export const PutFirewallConfigSecurityType = {
  BotCategory: "bot_category",
  BotName: "bot_name",
  BotProtection: "bot_protection",
  BotStatus: "bot_status",
  Cookie: "cookie",
  DomainEnvironment: "domain_environment",
  Environment: "environment",
  GeoAsNumber: "geo_as_number",
  GeoCity: "geo_city",
  GeoContinent: "geo_continent",
  GeoCountry: "geo_country",
  GeoCountryRegion: "geo_country_region",
  Header: "header",
  Host: "host",
  IpAddress: "ip_address",
  Ja3Digest: "ja3_digest",
  Ja4Digest: "ja4_digest",
  Method: "method",
  Path: "path",
  Protocol: "protocol",
  Query: "query",
  RateLimitApiId: "rate_limit_api_id",
  RawPath: "raw_path",
  Region: "region",
  Route: "route",
  Ruleset: "ruleset",
  Scheme: "scheme",
  ServerAction: "server_action",
  SharedCondition: "shared_condition",
  TargetPath: "target_path",
  TrafficSource: "traffic_source",
  TrustedSource: "trusted_source",
  UserAgent: "user_agent",
} as const;
export type PutFirewallConfigSecurityType = ClosedEnum<
  typeof PutFirewallConfigSecurityType
>;

export const PutFirewallConfigSecurityOp = {
  Eq: "eq",
  Ex: "ex",
  Gt: "gt",
  Gte: "gte",
  Inc: "inc",
  List: "list",
  Lt: "lt",
  Lte: "lte",
  Neq: "neq",
  Nex: "nex",
  Ninc: "ninc",
  Pre: "pre",
  Re: "re",
  Sub: "sub",
  Suf: "suf",
} as const;
export type PutFirewallConfigSecurityOp = ClosedEnum<
  typeof PutFirewallConfigSecurityOp
>;

export type PutFirewallConfigSecurityValue = string | number | Array<string>;

export type PutFirewallConfigSecurityResponseConditions = {
  type: PutFirewallConfigSecurityType;
  op: PutFirewallConfigSecurityOp;
  neg?: boolean | undefined;
  key?: string | undefined;
  value?: string | number | Array<string> | undefined;
};

export type PutFirewallConfigConditionGroup = {
  conditions: Array<PutFirewallConfigSecurityResponseConditions>;
};

export type PutFirewallConfigSecurityConditions = {
  description?: string | undefined;
  id: string;
  name: string;
  active: boolean;
  conditionGroup: Array<PutFirewallConfigConditionGroup>;
};

export type PutFirewallConfigChanges = {};

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

export type PutFirewallConfigBotProtection = {
  active: boolean;
  action?:
    | PutFirewallConfigSecurityResponse200ApplicationJSONResponseBodyActiveManagedRulesAction
    | undefined;
  updatedAt?: string | undefined;
  userId?: string | undefined;
  username?: string | undefined;
};

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

export type PutFirewallConfigAiBots = {
  active: boolean;
  action?:
    | PutFirewallConfigSecurityResponse200ApplicationJSONResponseBodyActiveManagedRulesAiBotsAction
    | undefined;
  updatedAt?: string | undefined;
  userId?: string | undefined;
  username?: string | undefined;
};

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

export type PutFirewallConfigOwasp = {
  active: boolean;
  action?:
    | PutFirewallConfigSecurityResponse200ApplicationJSONResponseBodyActiveManagedRulesOwaspAction
    | undefined;
  updatedAt?: string | undefined;
  userId?: string | undefined;
  username?: string | undefined;
};

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

export type PutFirewallConfigVercelRuleset = {
  active: boolean;
  action?:
    | PutFirewallConfigSecurityResponse200ApplicationJSONResponseBodyActiveManagedRulesVercelRulesetAction
    | undefined;
  updatedAt?: string | undefined;
  userId?: string | undefined;
  username?: string | undefined;
};

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

export type PutFirewallConfigTrafficSources = {
  active: boolean;
  action?:
    | PutFirewallConfigSecurityResponse200ApplicationJSONResponseBodyActiveManagedRulesTrafficSourcesAction
    | undefined;
  updatedAt?: string | undefined;
  userId?: string | undefined;
  username?: string | undefined;
};

export type PutFirewallConfigManagedRules = {
  botProtection?: PutFirewallConfigBotProtection | undefined;
  aiBots?: PutFirewallConfigAiBots | undefined;
  owasp?: PutFirewallConfigOwasp | undefined;
  vercelRuleset?: PutFirewallConfigVercelRuleset | undefined;
  trafficSources?: PutFirewallConfigTrafficSources | undefined;
};

export const PutFirewallConfigLogHeaders2 = {
  Wildcard: "*",
} as const;
export type PutFirewallConfigLogHeaders2 = ClosedEnum<
  typeof PutFirewallConfigLogHeaders2
>;

export type PutFirewallConfigSecurityLogHeaders =
  | Array<string>
  | PutFirewallConfigLogHeaders2;

export type PutFirewallConfigActive = {
  ownerId: string;
  projectKey: string;
  id: string;
  version: number;
  updatedAt: string;
  firewallEnabled: boolean;
  /**
   * Custom Ruleset
   */
  crs?: PutFirewallConfigCrs | undefined;
  rules: Array<PutFirewallConfigRules1 | PutFirewallConfigRules2>;
  ips: Array<PutFirewallConfigIps>;
  rulesets?: Array<PutFirewallConfigRulesets1> | {
    [k: string]: PutFirewallConfigRulesets2;
  } | undefined;
  conditions?: Array<PutFirewallConfigSecurityConditions> | undefined;
  changes: Array<PutFirewallConfigChanges>;
  managedRules?: PutFirewallConfigManagedRules | undefined;
  botIdEnabled?: boolean | undefined;
  logHeaders?: Array<string> | PutFirewallConfigLogHeaders2 | undefined;
};

export type PutFirewallConfigResponseBody = {
  active: PutFirewallConfigActive;
};

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

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

export function managedRulesToJSON(managedRules: ManagedRules): string {
  return JSON.stringify(ManagedRules$outboundSchema.parse(managedRules));
}

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

/** @internal */
export type Sd$Outbound = {
  active: boolean;
  action: string;
};

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

export function sdToJSON(sd: Sd): string {
  return JSON.stringify(Sd$outboundSchema.parse(sd));
}

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

/** @internal */
export type Ma$Outbound = {
  active: boolean;
  action: string;
};

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

export function maToJSON(ma: Ma): string {
  return JSON.stringify(Ma$outboundSchema.parse(ma));
}

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

/** @internal */
export type Lfi$Outbound = {
  active: boolean;
  action: string;
};

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

export function lfiToJSON(lfi: Lfi): string {
  return JSON.stringify(Lfi$outboundSchema.parse(lfi));
}

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

/** @internal */
export type Rfi$Outbound = {
  active: boolean;
  action: string;
};

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

export function rfiToJSON(rfi: Rfi): string {
  return JSON.stringify(Rfi$outboundSchema.parse(rfi));
}

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

/** @internal */
export type Rce$Outbound = {
  active: boolean;
  action: string;
};

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

export function rceToJSON(rce: Rce): string {
  return JSON.stringify(Rce$outboundSchema.parse(rce));
}

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

/** @internal */
export type Php$Outbound = {
  active: boolean;
  action: string;
};

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

export function phpToJSON(php: Php): string {
  return JSON.stringify(Php$outboundSchema.parse(php));
}

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

/** @internal */
export type Gen$Outbound = {
  active: boolean;
  action: string;
};

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

export function genToJSON(gen: Gen): string {
  return JSON.stringify(Gen$outboundSchema.parse(gen));
}

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

/** @internal */
export type Xss$Outbound = {
  active: boolean;
  action: string;
};

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

export function xssToJSON(xss: Xss): string {
  return JSON.stringify(Xss$outboundSchema.parse(xss));
}

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

/** @internal */
export type Sqli$Outbound = {
  active: boolean;
  action: string;
};

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

export function sqliToJSON(sqli: Sqli): string {
  return JSON.stringify(Sqli$outboundSchema.parse(sqli));
}

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

/** @internal */
export type Sf$Outbound = {
  active: boolean;
  action: string;
};

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

export function sfToJSON(sf: Sf): string {
  return JSON.stringify(Sf$outboundSchema.parse(sf));
}

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

/** @internal */
export type Java$Outbound = {
  active: boolean;
  action: string;
};

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

export function javaToJSON(java: Java): string {
  return JSON.stringify(Java$outboundSchema.parse(java));
}

/** @internal */
export type Crs$Outbound = {
  sd?: Sd$Outbound | undefined;
  ma?: Ma$Outbound | undefined;
  lfi?: Lfi$Outbound | undefined;
  rfi?: Rfi$Outbound | undefined;
  rce?: Rce$Outbound | undefined;
  php?: Php$Outbound | undefined;
  gen?: Gen$Outbound | undefined;
  xss?: Xss$Outbound | undefined;
  sqli?: Sqli$Outbound | undefined;
  sf?: Sf$Outbound | undefined;
  java?: Java$Outbound | undefined;
};

/** @internal */
export const Crs$outboundSchema: z.ZodType<Crs$Outbound, z.ZodTypeDef, Crs> = z
  .object({
    sd: z.lazy(() => Sd$outboundSchema).optional(),
    ma: z.lazy(() => Ma$outboundSchema).optional(),
    lfi: z.lazy(() => Lfi$outboundSchema).optional(),
    rfi: z.lazy(() => Rfi$outboundSchema).optional(),
    rce: z.lazy(() => Rce$outboundSchema).optional(),
    php: z.lazy(() => Php$outboundSchema).optional(),
    gen: z.lazy(() => Gen$outboundSchema).optional(),
    xss: z.lazy(() => Xss$outboundSchema).optional(),
    sqli: z.lazy(() => Sqli$outboundSchema).optional(),
    sf: z.lazy(() => Sf$outboundSchema).optional(),
    java: z.lazy(() => Java$outboundSchema).optional(),
  });

export function crsToJSON(crs: Crs): string {
  return JSON.stringify(Crs$outboundSchema.parse(crs));
}

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

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

/** @internal */
export type PutFirewallConfigValue$Outbound = string | Array<string> | number;

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

export function putFirewallConfigValueToJSON(
  putFirewallConfigValue: PutFirewallConfigValue,
): string {
  return JSON.stringify(
    PutFirewallConfigValue$outboundSchema.parse(putFirewallConfigValue),
  );
}

/** @internal */
export type PutFirewallConfigConditions$Outbound = {
  type: string;
  op: string;
  neg?: boolean | undefined;
  key?: string | undefined;
  value?: string | Array<string> | number | undefined;
};

/** @internal */
export const PutFirewallConfigConditions$outboundSchema: z.ZodType<
  PutFirewallConfigConditions$Outbound,
  z.ZodTypeDef,
  PutFirewallConfigConditions
> = z.object({
  type: PutFirewallConfigType$outboundSchema,
  op: PutFirewallConfigOp$outboundSchema,
  neg: z.boolean().optional(),
  key: z.string().optional(),
  value: smartUnion([z.string(), z.array(z.string()), z.number()]).optional(),
});

export function putFirewallConfigConditionsToJSON(
  putFirewallConfigConditions: PutFirewallConfigConditions,
): string {
  return JSON.stringify(
    PutFirewallConfigConditions$outboundSchema.parse(
      putFirewallConfigConditions,
    ),
  );
}

/** @internal */
export type ConditionGroup$Outbound = {
  conditions: Array<PutFirewallConfigConditions$Outbound>;
};

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

export function conditionGroupToJSON(conditionGroup: ConditionGroup): string {
  return JSON.stringify(ConditionGroup$outboundSchema.parse(conditionGroup));
}

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

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

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

/** @internal */
export type RateLimitAction$Outbound = string | any;

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

export function rateLimitActionToJSON(
  rateLimitAction: RateLimitAction,
): string {
  return JSON.stringify(RateLimitAction$outboundSchema.parse(rateLimitAction));
}

/** @internal */
export type RateLimit1$Outbound = {
  algo: string;
  window: number;
  limit: number;
  keys: Array<string>;
  action?: string | any | null | undefined;
};

/** @internal */
export const RateLimit1$outboundSchema: z.ZodType<
  RateLimit1$Outbound,
  z.ZodTypeDef,
  RateLimit1
> = z.object({
  algo: Algo$outboundSchema,
  window: z.number(),
  limit: z.number(),
  keys: z.array(z.string()),
  action: z.nullable(smartUnion([Action1$outboundSchema, z.any()])).optional(),
});

export function rateLimit1ToJSON(rateLimit1: RateLimit1): string {
  return JSON.stringify(RateLimit1$outboundSchema.parse(rateLimit1));
}

/** @internal */
export type RateLimit$Outbound = RateLimit1$Outbound | any;

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

export function rateLimitToJSON(rateLimit: RateLimit): string {
  return JSON.stringify(RateLimit$outboundSchema.parse(rateLimit));
}

/** @internal */
export type Redirect1$Outbound = {
  location: string;
  permanent: boolean;
};

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

export function redirect1ToJSON(redirect1: Redirect1): string {
  return JSON.stringify(Redirect1$outboundSchema.parse(redirect1));
}

/** @internal */
export type PutFirewallConfigRedirect$Outbound = Redirect1$Outbound | any;

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

export function putFirewallConfigRedirectToJSON(
  putFirewallConfigRedirect: PutFirewallConfigRedirect,
): string {
  return JSON.stringify(
    PutFirewallConfigRedirect$outboundSchema.parse(putFirewallConfigRedirect),
  );
}

/** @internal */
export type LogHeaders$Outbound = string | Array<string>;

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

export function logHeadersToJSON(logHeaders: LogHeaders): string {
  return JSON.stringify(LogHeaders$outboundSchema.parse(logHeaders));
}

/** @internal */
export type Mitigate$Outbound = {
  action: string;
  rateLimit?: RateLimit1$Outbound | any | null | undefined;
  redirect?: Redirect1$Outbound | any | null | undefined;
  actionDuration?: string | null | undefined;
  bypassSystem?: boolean | null | undefined;
  logHeaders?: string | Array<string> | undefined;
};

/** @internal */
export const Mitigate$outboundSchema: z.ZodType<
  Mitigate$Outbound,
  z.ZodTypeDef,
  Mitigate
> = z.object({
  action:
    PutFirewallConfigSecurityRequestRequestBodyRulesActionAction$outboundSchema,
  rateLimit: z.nullable(
    smartUnion([z.lazy(() => RateLimit1$outboundSchema), z.any()]),
  ).optional(),
  redirect: z.nullable(
    smartUnion([z.lazy(() => Redirect1$outboundSchema), z.any()]),
  ).optional(),
  actionDuration: z.nullable(z.string()).optional(),
  bypassSystem: z.nullable(z.boolean()).optional(),
  logHeaders: smartUnion([z.string(), z.array(z.string())]).optional(),
});

export function mitigateToJSON(mitigate: Mitigate): string {
  return JSON.stringify(Mitigate$outboundSchema.parse(mitigate));
}

/** @internal */
export type PutFirewallConfigSecurityRequestRequestBodyRulesAction$Outbound = {
  mitigate?: Mitigate$Outbound | undefined;
};

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

export function putFirewallConfigSecurityRequestRequestBodyRulesActionToJSON(
  putFirewallConfigSecurityRequestRequestBodyRulesAction:
    PutFirewallConfigSecurityRequestRequestBodyRulesAction,
): string {
  return JSON.stringify(
    PutFirewallConfigSecurityRequestRequestBodyRulesAction$outboundSchema.parse(
      putFirewallConfigSecurityRequestRequestBodyRulesAction,
    ),
  );
}

/** @internal */
export type ValidationErrors$Outbound = Array<string> | string;

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

export function validationErrorsToJSON(
  validationErrors: ValidationErrors,
): string {
  return JSON.stringify(
    ValidationErrors$outboundSchema.parse(validationErrors),
  );
}

/** @internal */
export type PutFirewallConfigRules$Outbound = {
  id?: string | undefined;
  name: string;
  description?: string | undefined;
  active: boolean;
  conditionGroup: Array<ConditionGroup$Outbound>;
  action: PutFirewallConfigSecurityRequestRequestBodyRulesAction$Outbound;
  valid?: boolean | undefined;
  validationErrors?: Array<string> | string | undefined;
};

/** @internal */
export const PutFirewallConfigRules$outboundSchema: z.ZodType<
  PutFirewallConfigRules$Outbound,
  z.ZodTypeDef,
  PutFirewallConfigRules
> = z.object({
  id: z.string().optional(),
  name: z.string(),
  description: z.string().optional(),
  active: z.boolean(),
  conditionGroup: z.array(z.lazy(() => ConditionGroup$outboundSchema)),
  action: z.lazy(() =>
    PutFirewallConfigSecurityRequestRequestBodyRulesAction$outboundSchema
  ),
  valid: z.boolean().optional(),
  validationErrors: smartUnion([z.array(z.string()), z.string()]).optional(),
});

export function putFirewallConfigRulesToJSON(
  putFirewallConfigRules: PutFirewallConfigRules,
): string {
  return JSON.stringify(
    PutFirewallConfigRules$outboundSchema.parse(putFirewallConfigRules),
  );
}

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

/** @internal */
export type Rulesets2$Outbound = {
  action: string;
};

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

export function rulesets2ToJSON(rulesets2: Rulesets2): string {
  return JSON.stringify(Rulesets2$outboundSchema.parse(rulesets2));
}

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

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

/** @internal */
export type RulesetsValue$Outbound = string | Array<string> | number;

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

export function rulesetsValueToJSON(rulesetsValue: RulesetsValue): string {
  return JSON.stringify(RulesetsValue$outboundSchema.parse(rulesetsValue));
}

/** @internal */
export type RulesetsConditions$Outbound = {
  type: string;
  op: string;
  neg?: boolean | undefined;
  key?: string | undefined;
  value?: string | Array<string> | number | undefined;
};

/** @internal */
export const RulesetsConditions$outboundSchema: z.ZodType<
  RulesetsConditions$Outbound,
  z.ZodTypeDef,
  RulesetsConditions
> = z.object({
  type: RulesetsType$outboundSchema,
  op: RulesetsOp$outboundSchema,
  neg: z.boolean().optional(),
  key: z.string().optional(),
  value: smartUnion([z.string(), z.array(z.string()), z.number()]).optional(),
});

export function rulesetsConditionsToJSON(
  rulesetsConditions: RulesetsConditions,
): string {
  return JSON.stringify(
    RulesetsConditions$outboundSchema.parse(rulesetsConditions),
  );
}

/** @internal */
export type RulesetsConditionGroup$Outbound = {
  conditions: Array<RulesetsConditions$Outbound>;
};

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

export function rulesetsConditionGroupToJSON(
  rulesetsConditionGroup: RulesetsConditionGroup,
): string {
  return JSON.stringify(
    RulesetsConditionGroup$outboundSchema.parse(rulesetsConditionGroup),
  );
}

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

/** @internal */
export type RulesetsMitigate$Outbound = {
  action: string;
};

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

export function rulesetsMitigateToJSON(
  rulesetsMitigate: RulesetsMitigate,
): string {
  return JSON.stringify(
    RulesetsMitigate$outboundSchema.parse(rulesetsMitigate),
  );
}

/** @internal */
export type RulesetsAction$Outbound = {
  mitigate?: RulesetsMitigate$Outbound | undefined;
};

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

export function rulesetsActionToJSON(rulesetsAction: RulesetsAction): string {
  return JSON.stringify(RulesetsAction$outboundSchema.parse(rulesetsAction));
}

/** @internal */
export type RulesetsValidationErrors$Outbound = Array<string> | string;

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

export function rulesetsValidationErrorsToJSON(
  rulesetsValidationErrors: RulesetsValidationErrors,
): string {
  return JSON.stringify(
    RulesetsValidationErrors$outboundSchema.parse(rulesetsValidationErrors),
  );
}

/** @internal */
export type Rulesets1$Outbound = {
  id?: string | undefined;
  name: string;
  description?: string | undefined;
  active: boolean;
  conditionGroup: Array<RulesetsConditionGroup$Outbound>;
  action?: RulesetsAction$Outbound | undefined;
  valid?: boolean | undefined;
  validationErrors?: Array<string> | string | undefined;
};

/** @internal */
export const Rulesets1$outboundSchema: z.ZodType<
  Rulesets1$Outbound,
  z.ZodTypeDef,
  Rulesets1
> = z.object({
  id: z.string().optional(),
  name: z.string(),
  description: z.string().optional(),
  active: z.boolean(),
  conditionGroup: z.array(z.lazy(() => RulesetsConditionGroup$outboundSchema)),
  action: z.lazy(() => RulesetsAction$outboundSchema).optional(),
  valid: z.boolean().optional(),
  validationErrors: smartUnion([z.array(z.string()), z.string()]).optional(),
});

export function rulesets1ToJSON(rulesets1: Rulesets1): string {
  return JSON.stringify(Rulesets1$outboundSchema.parse(rulesets1));
}

/** @internal */
export type Rulesets$Outbound = Array<Rulesets1$Outbound> | {
  [k: string]: Rulesets2$Outbound;
};

/** @internal */
export const Rulesets$outboundSchema: z.ZodType<
  Rulesets$Outbound,
  z.ZodTypeDef,
  Rulesets
> = smartUnion([
  z.array(z.lazy(() => Rulesets1$outboundSchema)),
  z.record(z.lazy(() => Rulesets2$outboundSchema)),
]);

export function rulesetsToJSON(rulesets: Rulesets): string {
  return JSON.stringify(Rulesets$outboundSchema.parse(rulesets));
}

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

/** @internal */
export type Ips$Outbound = {
  id?: string | undefined;
  hostname: string;
  ip: string;
  notes?: string | undefined;
  action: string;
};

/** @internal */
export const Ips$outboundSchema: z.ZodType<Ips$Outbound, z.ZodTypeDef, Ips> = z
  .object({
    id: z.string().optional(),
    hostname: z.string(),
    ip: z.string(),
    notes: z.string().optional(),
    action: PutFirewallConfigSecurityRequestRequestBodyIpsAction$outboundSchema,
  });

export function ipsToJSON(ips: Ips): string {
  return JSON.stringify(Ips$outboundSchema.parse(ips));
}

/** @internal */
export type PutFirewallConfigLogHeaders$Outbound = string | Array<string>;

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

export function putFirewallConfigLogHeadersToJSON(
  putFirewallConfigLogHeaders: PutFirewallConfigLogHeaders,
): string {
  return JSON.stringify(
    PutFirewallConfigLogHeaders$outboundSchema.parse(
      putFirewallConfigLogHeaders,
    ),
  );
}

/** @internal */
export type PutFirewallConfigRequestBody$Outbound = {
  firewallEnabled: boolean;
  managedRules?: ManagedRules$Outbound | undefined;
  crs?: Crs$Outbound | undefined;
  rules?: Array<PutFirewallConfigRules$Outbound> | undefined;
  rulesets?:
    | Array<Rulesets1$Outbound>
    | { [k: string]: Rulesets2$Outbound }
    | undefined;
  ips?: Array<Ips$Outbound> | undefined;
  botIdEnabled?: boolean | undefined;
  logHeaders?: string | Array<string> | undefined;
};

/** @internal */
export const PutFirewallConfigRequestBody$outboundSchema: z.ZodType<
  PutFirewallConfigRequestBody$Outbound,
  z.ZodTypeDef,
  PutFirewallConfigRequestBody
> = z.object({
  firewallEnabled: z.boolean(),
  managedRules: z.lazy(() => ManagedRules$outboundSchema).optional(),
  crs: z.lazy(() => Crs$outboundSchema).optional(),
  rules: z.array(z.lazy(() => PutFirewallConfigRules$outboundSchema))
    .optional(),
  rulesets: smartUnion([
    z.array(z.lazy(() => Rulesets1$outboundSchema)),
    z.record(z.lazy(() => Rulesets2$outboundSchema)),
  ]).optional(),
  ips: z.array(z.lazy(() => Ips$outboundSchema)).optional(),
  botIdEnabled: z.boolean().optional(),
  logHeaders: smartUnion([z.string(), z.array(z.string())]).optional(),
});

export function putFirewallConfigRequestBodyToJSON(
  putFirewallConfigRequestBody: PutFirewallConfigRequestBody,
): string {
  return JSON.stringify(
    PutFirewallConfigRequestBody$outboundSchema.parse(
      putFirewallConfigRequestBody,
    ),
  );
}

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

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

export function putFirewallConfigRequestToJSON(
  putFirewallConfigRequest: PutFirewallConfigRequest,
): string {
  return JSON.stringify(
    PutFirewallConfigRequest$outboundSchema.parse(putFirewallConfigRequest),
  );
}

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

/** @internal */
export const PutFirewallConfigCrs$inboundSchema: z.ZodType<
  PutFirewallConfigCrs,
  z.ZodTypeDef,
  unknown
> = z.object({
  sd: z.lazy(() => PutFirewallConfigSd$inboundSchema),
  ma: z.lazy(() => PutFirewallConfigMa$inboundSchema),
  lfi: z.lazy(() => PutFirewallConfigLfi$inboundSchema),
  rfi: z.lazy(() => PutFirewallConfigRfi$inboundSchema),
  rce: z.lazy(() => PutFirewallConfigRce$inboundSchema),
  php: z.lazy(() => PutFirewallConfigPhp$inboundSchema),
  gen: z.lazy(() => PutFirewallConfigGen$inboundSchema),
  xss: z.lazy(() => PutFirewallConfigXss$inboundSchema),
  sqli: z.lazy(() => PutFirewallConfigSqli$inboundSchema),
  sf: z.lazy(() => PutFirewallConfigSf$inboundSchema),
  java: z.lazy(() => PutFirewallConfigJava$inboundSchema),
});

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

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

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

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

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

/** @internal */
export const PutFirewallConfigRulesSecurityConditions$inboundSchema: z.ZodType<
  PutFirewallConfigRulesSecurityConditions,
  z.ZodTypeDef,
  unknown
> = z.object({
  type: PutFirewallConfigRulesSecurityType$inboundSchema,
  op: PutFirewallConfigRulesSecurityOp$inboundSchema,
  neg: types.optional(types.boolean()),
  key: types.optional(types.string()),
  value: types.optional(
    smartUnion([types.string(), types.number(), z.array(types.string())]),
  ),
});

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

/** @internal */
export const PutFirewallConfigRulesSecurityConditionGroup$inboundSchema:
  z.ZodType<
    PutFirewallConfigRulesSecurityConditionGroup,
    z.ZodTypeDef,
    unknown
  > = z.object({
    conditions: z.array(
      z.lazy(() => PutFirewallConfigRulesSecurityConditions$inboundSchema),
    ),
  });

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

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

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

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

/** @internal */
export const PutFirewallConfigRulesSecurityRateLimit$inboundSchema: z.ZodType<
  PutFirewallConfigRulesSecurityRateLimit,
  z.ZodTypeDef,
  unknown
> = z.object({
  algo: PutFirewallConfigRulesSecurityAlgo$inboundSchema,
  window: types.number(),
  limit: types.number(),
  keys: z.array(types.string()),
  action: z.nullable(
    PutFirewallConfigRulesSecurityResponse200ApplicationJSONAction$inboundSchema,
  ).optional(),
});

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

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

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

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

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

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

/** @internal */
export const PutFirewallConfigRulesSecurityMitigate$inboundSchema: z.ZodType<
  PutFirewallConfigRulesSecurityMitigate,
  z.ZodTypeDef,
  unknown
> = z.object({
  action: PutFirewallConfigRulesSecurityResponseAction$inboundSchema,
  rateLimit: z.nullable(
    z.lazy(() => PutFirewallConfigRulesSecurityRateLimit$inboundSchema),
  ).optional(),
  redirect: z.nullable(
    z.lazy(() => PutFirewallConfigRulesSecurityRedirect$inboundSchema),
  ).optional(),
  actionDuration: z.nullable(types.string()).optional(),
  bypassSystem: z.nullable(types.boolean()).optional(),
  logHeaders: types.optional(
    smartUnion([
      z.array(types.string()),
      PutFirewallConfigLogHeadersSecurityResponse200ApplicationJson2$inboundSchema,
    ]),
  ),
});

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

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

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

/** @internal */
export const PutFirewallConfigRules2$inboundSchema: z.ZodType<
  PutFirewallConfigRules2,
  z.ZodTypeDef,
  unknown
> = z.object({
  id: types.string(),
  name: types.string(),
  description: types.optional(types.string()),
  active: types.boolean(),
  conditionGroup: z.array(
    z.lazy(() => PutFirewallConfigRulesSecurityConditionGroup$inboundSchema),
  ),
  action: z.lazy(() => PutFirewallConfigRulesSecurityAction$inboundSchema),
  valid: types.literal(false),
  validationErrors: z.array(types.string()),
});

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

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

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

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

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

/** @internal */
export const PutFirewallConfigRulesConditions$inboundSchema: z.ZodType<
  PutFirewallConfigRulesConditions,
  z.ZodTypeDef,
  unknown
> = z.object({
  type: PutFirewallConfigRulesType$inboundSchema,
  op: PutFirewallConfigRulesOp$inboundSchema,
  neg: types.optional(types.boolean()),
  key: types.optional(types.string()),
  value: types.optional(
    smartUnion([types.string(), types.number(), z.array(types.string())]),
  ),
});

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

/** @internal */
export const PutFirewallConfigRulesConditionGroup$inboundSchema: z.ZodType<
  PutFirewallConfigRulesConditionGroup,
  z.ZodTypeDef,
  unknown
> = z.object({
  conditions: z.array(
    z.lazy(() => PutFirewallConfigRulesConditions$inboundSchema),
  ),
});

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

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

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

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

/** @internal */
export const PutFirewallConfigRulesRateLimit$inboundSchema: z.ZodType<
  PutFirewallConfigRulesRateLimit,
  z.ZodTypeDef,
  unknown
> = z.object({
  algo: PutFirewallConfigRulesAlgo$inboundSchema,
  window: types.number(),
  limit: types.number(),
  keys: z.array(types.string()),
  action: z.nullable(
    PutFirewallConfigRulesSecurityResponse200ApplicationJSONResponseBodyAction$inboundSchema,
  ).optional(),
});

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

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

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

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

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

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

/** @internal */
export const PutFirewallConfigRulesMitigate$inboundSchema: z.ZodType<
  PutFirewallConfigRulesMitigate,
  z.ZodTypeDef,
  unknown
> = z.object({
  action: PutFirewallConfigRulesSecurityResponse200Action$inboundSchema,
  rateLimit: z.nullable(
    z.lazy(() => PutFirewallConfigRulesRateLimit$inboundSchema),
  ).optional(),
  redirect: z.nullable(
    z.lazy(() => PutFirewallConfigRulesRedirect$inboundSchema),
  ).optional(),
  actionDuration: z.nullable(types.string()).optional(),
  bypassSystem: z.nullable(types.boolean()).optional(),
  logHeaders: types.optional(
    smartUnion([
      z.array(types.string()),
      PutFirewallConfigLogHeadersSecurityResponse2002$inboundSchema,
    ]),
  ),
});

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

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

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

/** @internal */
export const PutFirewallConfigRules1$inboundSchema: z.ZodType<
  PutFirewallConfigRules1,
  z.ZodTypeDef,
  unknown
> = z.object({
  id: types.string(),
  name: types.string(),
  description: types.optional(types.string()),
  active: types.boolean(),
  conditionGroup: z.array(
    z.lazy(() => PutFirewallConfigRulesConditionGroup$inboundSchema),
  ),
  action: z.lazy(() => PutFirewallConfigRulesAction$inboundSchema),
  valid: types.literal(true),
  validationErrors: z.nullable(z.any()).optional(),
});

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

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

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

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

/** @internal */
export const PutFirewallConfigIps$inboundSchema: z.ZodType<
  PutFirewallConfigIps,
  z.ZodTypeDef,
  unknown
> = z.object({
  id: types.string(),
  hostname: types.string(),
  ip: types.string(),
  notes: types.optional(types.string()),
  action: PutFirewallConfigSecurityResponseAction$inboundSchema,
});

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

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

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

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

/** @internal */
export const PutFirewallConfigRulesetsRateLimit$inboundSchema: z.ZodType<
  PutFirewallConfigRulesetsRateLimit,
  z.ZodTypeDef,
  unknown
> = z.object({
  algo: PutFirewallConfigRulesetsAlgo$inboundSchema,
  window: types.number(),
  limit: types.number(),
  keys: z.array(types.string()),
  action: z.nullable(
    PutFirewallConfigRulesetsSecurityResponse200ApplicationJSONAction$inboundSchema,
  ).optional(),
});

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

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

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

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

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

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

/** @internal */
export const PutFirewallConfigRulesets2$inboundSchema: z.ZodType<
  PutFirewallConfigRulesets2,
  z.ZodTypeDef,
  unknown
> = z.object({
  action: PutFirewallConfigRulesetsSecurityResponse200Action$inboundSchema,
  rateLimit: z.nullable(
    z.lazy(() => PutFirewallConfigRulesetsRateLimit$inboundSchema),
  ).optional(),
  redirect: z.nullable(
    z.lazy(() => PutFirewallConfigRulesetsRedirect$inboundSchema),
  ).optional(),
  actionDuration: z.nullable(types.string()).optional(),
  bypassSystem: z.nullable(types.boolean()).optional(),
  logHeaders: types.optional(
    smartUnion([
      z.array(types.string()),
      PutFirewallConfigLogHeadersSecurity2$inboundSchema,
    ]),
  ),
});

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

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

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

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

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

/** @internal */
export const PutFirewallConfigRulesetsConditions$inboundSchema: z.ZodType<
  PutFirewallConfigRulesetsConditions,
  z.ZodTypeDef,
  unknown
> = z.object({
  type: PutFirewallConfigRulesetsType$inboundSchema,
  op: PutFirewallConfigRulesetsOp$inboundSchema,
  neg: types.optional(types.boolean()),
  key: types.optional(types.string()),
  value: types.optional(
    smartUnion([types.string(), types.number(), z.array(types.string())]),
  ),
});

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

/** @internal */
export const PutFirewallConfigRulesetsConditionGroup$inboundSchema: z.ZodType<
  PutFirewallConfigRulesetsConditionGroup,
  z.ZodTypeDef,
  unknown
> = z.object({
  conditions: z.array(
    z.lazy(() => PutFirewallConfigRulesetsConditions$inboundSchema),
  ),
});

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

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

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

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

/** @internal */
export const PutFirewallConfigRulesetsSecurityRateLimit$inboundSchema:
  z.ZodType<PutFirewallConfigRulesetsSecurityRateLimit, z.ZodTypeDef, unknown> =
    z.object({
      algo: PutFirewallConfigRulesetsSecurityAlgo$inboundSchema,
      window: types.number(),
      limit: types.number(),
      keys: z.array(types.string()),
      action: z.nullable(
        PutFirewallConfigRulesetsSecurityResponse200ApplicationJSONResponseBodyActiveAction$inboundSchema,
      ).optional(),
    });

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

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

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

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

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

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

/** @internal */
export const PutFirewallConfigRulesetsMitigate$inboundSchema: z.ZodType<
  PutFirewallConfigRulesetsMitigate,
  z.ZodTypeDef,
  unknown
> = z.object({
  action:
    PutFirewallConfigRulesetsSecurityResponse200ApplicationJSONResponseBodyAction$inboundSchema,
  rateLimit: z.nullable(
    z.lazy(() => PutFirewallConfigRulesetsSecurityRateLimit$inboundSchema),
  ).optional(),
  redirect: z.nullable(
    z.lazy(() => PutFirewallConfigRulesetsSecurityRedirect$inboundSchema),
  ).optional(),
  actionDuration: z.nullable(types.string()).optional(),
  bypassSystem: z.nullable(types.boolean()).optional(),
  logHeaders: types.optional(
    smartUnion([
      z.array(types.string()),
      PutFirewallConfigLogHeadersSecurityResponse2$inboundSchema,
    ]),
  ),
});

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

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

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

/** @internal */
export const PutFirewallConfigRulesets1$inboundSchema: z.ZodType<
  PutFirewallConfigRulesets1,
  z.ZodTypeDef,
  unknown
> = z.object({
  description: types.optional(types.string()),
  id: types.string(),
  name: types.string(),
  active: types.boolean(),
  conditionGroup: z.array(
    z.lazy(() => PutFirewallConfigRulesetsConditionGroup$inboundSchema),
  ),
  action: types.optional(
    z.lazy(() => PutFirewallConfigRulesetsSecurityResponseAction$inboundSchema),
  ),
});

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

/** @internal */
export const PutFirewallConfigRulesets$inboundSchema: z.ZodType<
  PutFirewallConfigRulesets,
  z.ZodTypeDef,
  unknown
> = smartUnion([
  z.array(z.lazy(() => PutFirewallConfigRulesets1$inboundSchema)),
  z.record(z.lazy(() => PutFirewallConfigRulesets2$inboundSchema)),
]);

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

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

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

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

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

/** @internal */
export const PutFirewallConfigSecurityResponseConditions$inboundSchema:
  z.ZodType<
    PutFirewallConfigSecurityResponseConditions,
    z.ZodTypeDef,
    unknown
  > = z.object({
    type: PutFirewallConfigSecurityType$inboundSchema,
    op: PutFirewallConfigSecurityOp$inboundSchema,
    neg: types.optional(types.boolean()),
    key: types.optional(types.string()),
    value: types.optional(
      smartUnion([types.string(), types.number(), z.array(types.string())]),
    ),
  });

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

/** @internal */
export const PutFirewallConfigConditionGroup$inboundSchema: z.ZodType<
  PutFirewallConfigConditionGroup,
  z.ZodTypeDef,
  unknown
> = z.object({
  conditions: z.array(
    z.lazy(() => PutFirewallConfigSecurityResponseConditions$inboundSchema),
  ),
});

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

/** @internal */
export const PutFirewallConfigSecurityConditions$inboundSchema: z.ZodType<
  PutFirewallConfigSecurityConditions,
  z.ZodTypeDef,
  unknown
> = z.object({
  description: types.optional(types.string()),
  id: types.string(),
  name: types.string(),
  active: types.boolean(),
  conditionGroup: z.array(
    z.lazy(() => PutFirewallConfigConditionGroup$inboundSchema),
  ),
});

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

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

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

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

/** @internal */
export const PutFirewallConfigBotProtection$inboundSchema: z.ZodType<
  PutFirewallConfigBotProtection,
  z.ZodTypeDef,
  unknown
> = z.object({
  active: types.boolean(),
  action: types.optional(
    PutFirewallConfigSecurityResponse200ApplicationJSONResponseBodyActiveManagedRulesAction$inboundSchema,
  ),
  updatedAt: types.optional(types.string()),
  userId: types.optional(types.string()),
  username: types.optional(types.string()),
});

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

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

/** @internal */
export const PutFirewallConfigAiBots$inboundSchema: z.ZodType<
  PutFirewallConfigAiBots,
  z.ZodTypeDef,
  unknown
> = z.object({
  active: types.boolean(),
  action: types.optional(
    PutFirewallConfigSecurityResponse200ApplicationJSONResponseBodyActiveManagedRulesAiBotsAction$inboundSchema,
  ),
  updatedAt: types.optional(types.string()),
  userId: types.optional(types.string()),
  username: types.optional(types.string()),
});

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

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

/** @internal */
export const PutFirewallConfigOwasp$inboundSchema: z.ZodType<
  PutFirewallConfigOwasp,
  z.ZodTypeDef,
  unknown
> = z.object({
  active: types.boolean(),
  action: types.optional(
    PutFirewallConfigSecurityResponse200ApplicationJSONResponseBodyActiveManagedRulesOwaspAction$inboundSchema,
  ),
  updatedAt: types.optional(types.string()),
  userId: types.optional(types.string()),
  username: types.optional(types.string()),
});

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

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

/** @internal */
export const PutFirewallConfigVercelRuleset$inboundSchema: z.ZodType<
  PutFirewallConfigVercelRuleset,
  z.ZodTypeDef,
  unknown
> = z.object({
  active: types.boolean(),
  action: types.optional(
    PutFirewallConfigSecurityResponse200ApplicationJSONResponseBodyActiveManagedRulesVercelRulesetAction$inboundSchema,
  ),
  updatedAt: types.optional(types.string()),
  userId: types.optional(types.string()),
  username: types.optional(types.string()),
});

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

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

/** @internal */
export const PutFirewallConfigTrafficSources$inboundSchema: z.ZodType<
  PutFirewallConfigTrafficSources,
  z.ZodTypeDef,
  unknown
> = z.object({
  active: types.boolean(),
  action: types.optional(
    PutFirewallConfigSecurityResponse200ApplicationJSONResponseBodyActiveManagedRulesTrafficSourcesAction$inboundSchema,
  ),
  updatedAt: types.optional(types.string()),
  userId: types.optional(types.string()),
  username: types.optional(types.string()),
});

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

/** @internal */
export const PutFirewallConfigManagedRules$inboundSchema: z.ZodType<
  PutFirewallConfigManagedRules,
  z.ZodTypeDef,
  unknown
> = z.object({
  bot_protection: types.optional(
    z.lazy(() => PutFirewallConfigBotProtection$inboundSchema),
  ),
  ai_bots: types.optional(z.lazy(() => PutFirewallConfigAiBots$inboundSchema)),
  owasp: types.optional(z.lazy(() => PutFirewallConfigOwasp$inboundSchema)),
  vercel_ruleset: types.optional(
    z.lazy(() => PutFirewallConfigVercelRuleset$inboundSchema),
  ),
  traffic_sources: types.optional(
    z.lazy(() => PutFirewallConfigTrafficSources$inboundSchema),
  ),
}).transform((v) => {
  return remap$(v, {
    "bot_protection": "botProtection",
    "ai_bots": "aiBots",
    "vercel_ruleset": "vercelRuleset",
    "traffic_sources": "trafficSources",
  });
});

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

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

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

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

/** @internal */
export const PutFirewallConfigActive$inboundSchema: z.ZodType<
  PutFirewallConfigActive,
  z.ZodTypeDef,
  unknown
> = z.object({
  ownerId: types.string(),
  projectKey: types.string(),
  id: types.string(),
  version: types.number(),
  updatedAt: types.string(),
  firewallEnabled: types.boolean(),
  crs: types.optional(z.lazy(() => PutFirewallConfigCrs$inboundSchema)),
  rules: z.array(
    smartUnion([
      z.lazy(() => PutFirewallConfigRules1$inboundSchema),
      z.lazy(() => PutFirewallConfigRules2$inboundSchema),
    ]),
  ),
  ips: z.array(z.lazy(() => PutFirewallConfigIps$inboundSchema)),
  rulesets: types.optional(
    smartUnion([
      z.array(z.lazy(() => PutFirewallConfigRulesets1$inboundSchema)),
      z.record(z.lazy(() => PutFirewallConfigRulesets2$inboundSchema)),
    ]),
  ),
  conditions: types.optional(
    z.array(z.lazy(() => PutFirewallConfigSecurityConditions$inboundSchema)),
  ),
  changes: z.array(z.lazy(() => PutFirewallConfigChanges$inboundSchema)),
  managedRules: types.optional(
    z.lazy(() => PutFirewallConfigManagedRules$inboundSchema),
  ),
  botIdEnabled: types.optional(types.boolean()),
  logHeaders: types.optional(
    smartUnion([
      z.array(types.string()),
      PutFirewallConfigLogHeaders2$inboundSchema,
    ]),
  ),
});

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

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

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