/*
 * 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 ListDevicesResponse = {
  /**
   * 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
   */
  mediaContainerWithDevice?: shared.MediaContainerWithDevice | undefined;
  headers: { [k: string]: Array<string> };
};

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

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