/*
 * 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";
import * as shared from "../shared/index.js";

export type StopAllRefreshesResponse = {
  /**
   * 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;
  /**
   * OK
   */
  librarySections?: shared.LibrarySections | undefined;
};

/** @internal */
export const StopAllRefreshesResponse$inboundSchema: z.ZodType<
  StopAllRefreshesResponse,
  z.ZodTypeDef,
  unknown
> = z.object({
  ContentType: z.string(),
  StatusCode: z.number().int(),
  RawResponse: z.instanceof(Response),
  LibrarySections: shared.LibrarySections$inboundSchema.optional(),
}).transform((v) => {
  return remap$(v, {
    "ContentType": "contentType",
    "StatusCode": "statusCode",
    "RawResponse": "rawResponse",
    "LibrarySections": "librarySections",
  });
});

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