/*
 * 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 { Result as SafeParseResult } from "../../types/fp.js";
import { SDKValidationError } from "../errors/sdkvalidationerror.js";

export type ProcessSubscriptionsResponse = {
  /**
   * HTTP response content type for this operation
   */
  contentType: string;
  /**
   * HTTP response status code for this operation
   */
  statusCode: number;
  /**
   * Raw HTTP response; suitable for custom response parsing
   */
  rawResponse: Response;
  headers: { [k: string]: Array<string> };
};

/** @internal */
export const ProcessSubscriptionsResponse$inboundSchema: z.ZodType<
  ProcessSubscriptionsResponse,
  z.ZodTypeDef,
  unknown
> = z.object({
  ContentType: z.string(),
  StatusCode: z.number().int(),
  RawResponse: z.instanceof(Response),
  Headers: z.record(z.array(z.string())).default({}),
}).transform((v) => {
  return remap$(v, {
    "ContentType": "contentType",
    "StatusCode": "statusCode",
    "RawResponse": "rawResponse",
    "Headers": "headers",
  });
});

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