/*
 * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
 */

import * as z from "zod";
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 GetServerIdentityMediaContainer = {
  size?: number | undefined;
  claimed?: boolean | undefined;
  machineIdentifier?: string | undefined;
  version?: string | undefined;
};

/**
 * The Server Identity information
 */
export type GetServerIdentityResponseBody = {
  mediaContainer?: GetServerIdentityMediaContainer | undefined;
};

export type GetServerIdentityResponse = {
  /**
   * 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;
  /**
   * The Server Identity information
   */
  object?: GetServerIdentityResponseBody | undefined;
};

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

/** @internal */
export type GetServerIdentityMediaContainer$Outbound = {
  size?: number | undefined;
  claimed?: boolean | undefined;
  machineIdentifier?: string | undefined;
  version?: string | undefined;
};

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

/**
 * @internal
 * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
 */
export namespace GetServerIdentityMediaContainer$ {
  /** @deprecated use `GetServerIdentityMediaContainer$inboundSchema` instead. */
  export const inboundSchema = GetServerIdentityMediaContainer$inboundSchema;
  /** @deprecated use `GetServerIdentityMediaContainer$outboundSchema` instead. */
  export const outboundSchema = GetServerIdentityMediaContainer$outboundSchema;
  /** @deprecated use `GetServerIdentityMediaContainer$Outbound` instead. */
  export type Outbound = GetServerIdentityMediaContainer$Outbound;
}

export function getServerIdentityMediaContainerToJSON(
  getServerIdentityMediaContainer: GetServerIdentityMediaContainer,
): string {
  return JSON.stringify(
    GetServerIdentityMediaContainer$outboundSchema.parse(
      getServerIdentityMediaContainer,
    ),
  );
}

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

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

/** @internal */
export type GetServerIdentityResponseBody$Outbound = {
  MediaContainer?: GetServerIdentityMediaContainer$Outbound | undefined;
};

/** @internal */
export const GetServerIdentityResponseBody$outboundSchema: z.ZodType<
  GetServerIdentityResponseBody$Outbound,
  z.ZodTypeDef,
  GetServerIdentityResponseBody
> = z.object({
  mediaContainer: z.lazy(() => GetServerIdentityMediaContainer$outboundSchema)
    .optional(),
}).transform((v) => {
  return remap$(v, {
    mediaContainer: "MediaContainer",
  });
});

/**
 * @internal
 * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
 */
export namespace GetServerIdentityResponseBody$ {
  /** @deprecated use `GetServerIdentityResponseBody$inboundSchema` instead. */
  export const inboundSchema = GetServerIdentityResponseBody$inboundSchema;
  /** @deprecated use `GetServerIdentityResponseBody$outboundSchema` instead. */
  export const outboundSchema = GetServerIdentityResponseBody$outboundSchema;
  /** @deprecated use `GetServerIdentityResponseBody$Outbound` instead. */
  export type Outbound = GetServerIdentityResponseBody$Outbound;
}

export function getServerIdentityResponseBodyToJSON(
  getServerIdentityResponseBody: GetServerIdentityResponseBody,
): string {
  return JSON.stringify(
    GetServerIdentityResponseBody$outboundSchema.parse(
      getServerIdentityResponseBody,
    ),
  );
}

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

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

/** @internal */
export type GetServerIdentityResponse$Outbound = {
  ContentType: string;
  StatusCode: number;
  RawResponse: never;
  object?: GetServerIdentityResponseBody$Outbound | undefined;
};

/** @internal */
export const GetServerIdentityResponse$outboundSchema: z.ZodType<
  GetServerIdentityResponse$Outbound,
  z.ZodTypeDef,
  GetServerIdentityResponse
> = z.object({
  contentType: z.string(),
  statusCode: z.number().int(),
  rawResponse: z.instanceof(Response).transform(() => {
    throw new Error("Response cannot be serialized");
  }),
  object: z.lazy(() => GetServerIdentityResponseBody$outboundSchema).optional(),
}).transform((v) => {
  return remap$(v, {
    contentType: "ContentType",
    statusCode: "StatusCode",
    rawResponse: "RawResponse",
  });
});

/**
 * @internal
 * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
 */
export namespace GetServerIdentityResponse$ {
  /** @deprecated use `GetServerIdentityResponse$inboundSchema` instead. */
  export const inboundSchema = GetServerIdentityResponse$inboundSchema;
  /** @deprecated use `GetServerIdentityResponse$outboundSchema` instead. */
  export const outboundSchema = GetServerIdentityResponse$outboundSchema;
  /** @deprecated use `GetServerIdentityResponse$Outbound` instead. */
  export type Outbound = GetServerIdentityResponse$Outbound;
}

export function getServerIdentityResponseToJSON(
  getServerIdentityResponse: GetServerIdentityResponse,
): string {
  return JSON.stringify(
    GetServerIdentityResponse$outboundSchema.parse(getServerIdentityResponse),
  );
}

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