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

import * as z from "zod/v3";
import { safeParse } from "../lib/schemas.js";
import { Result as SafeParseResult } from "../types/fp.js";
import { AiGatewayRule, AiGatewayRule$inboundSchema } from "./aigatewayrule.js";
import { SDKValidationError } from "./sdkvalidationerror.js";

export type AiGatewayRuleList = {
  rules: Array<AiGatewayRule>;
};

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

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