/*
 * 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 GetIdentityMediaContainer = {
  /**
   * Indicates whether this server has been claimed by a user
   */
  claimed?: boolean | undefined;
  /**
   * A unique identifier of the computer
   */
  machineIdentifier?: string | undefined;
  size?: number | undefined;
  /**
   * The full version string of the PMS
   */
  version?: string | undefined;
};

/**
 * OK
 */
export type GetIdentityResponseBody = {
  mediaContainer?: GetIdentityMediaContainer | undefined;
};

export type GetIdentityResponse = {
  /**
   * 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
   */
  object?: GetIdentityResponseBody | undefined;
};

/** @internal */
export const GetIdentityMediaContainer$inboundSchema: z.ZodType<
  GetIdentityMediaContainer,
  z.ZodTypeDef,
  unknown
> = z.object({
  claimed: z.boolean().optional(),
  machineIdentifier: z.string().optional(),
  size: z.number().int().optional(),
  version: z.string().optional(),
});

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

/** @internal */
export const GetIdentityResponseBody$inboundSchema: z.ZodType<
  GetIdentityResponseBody,
  z.ZodTypeDef,
  unknown
> = z.object({
  MediaContainer: z.lazy(() => GetIdentityMediaContainer$inboundSchema)
    .optional(),
}).transform((v) => {
  return remap$(v, {
    "MediaContainer": "mediaContainer",
  });
});

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

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

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