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

import * as z from "zod/v4";
import { safeParse } from "../../lib/schemas.js";
import { Result as SafeParseResult } from "../../types/fp.js";
import { SDKValidationError } from "../errors/sdkvalidationerror.js";
import {
  PaginatedResultCampaignPreview,
  PaginatedResultCampaignPreview$inboundSchema,
} from "./paginatedresultcampaignpreview.js";

export type ListCampaignsResponse = {
  campaigns: PaginatedResultCampaignPreview;
};

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

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