/*
 * 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 GetAllPreferencesResponse = {
  /**
   * 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
   */
  mediaContainerWithSettings?: shared.MediaContainerWithSettings | undefined;
};

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

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