/*
 * 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 Server = {
  name?: string | undefined;
  host?: string | undefined;
  address?: string | undefined;
  port?: number | undefined;
  machineIdentifier?: string | undefined;
  version?: string | undefined;
  protocol?: string | undefined;
  product?: string | undefined;
  deviceClass?: string | undefined;
  protocolVersion?: number | undefined;
  protocolCapabilities?: string | undefined;
};

export type GetAvailableClientsMediaContainer = {
  size?: number | undefined;
  server?: Array<Server> | undefined;
};

/**
 * Available Clients
 */
export type GetAvailableClientsResponseBody = {
  mediaContainer?: GetAvailableClientsMediaContainer | undefined;
};

export type GetAvailableClientsResponse = {
  /**
   * 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;
  /**
   * Available Clients
   */
  object?: GetAvailableClientsResponseBody | undefined;
};

/** @internal */
export const Server$inboundSchema: z.ZodType<Server, z.ZodTypeDef, unknown> = z
  .object({
    name: z.string().optional(),
    host: z.string().optional(),
    address: z.string().optional(),
    port: z.number().optional(),
    machineIdentifier: z.string().optional(),
    version: z.string().optional(),
    protocol: z.string().optional(),
    product: z.string().optional(),
    deviceClass: z.string().optional(),
    protocolVersion: z.number().optional(),
    protocolCapabilities: z.string().optional(),
  });

/** @internal */
export type Server$Outbound = {
  name?: string | undefined;
  host?: string | undefined;
  address?: string | undefined;
  port?: number | undefined;
  machineIdentifier?: string | undefined;
  version?: string | undefined;
  protocol?: string | undefined;
  product?: string | undefined;
  deviceClass?: string | undefined;
  protocolVersion?: number | undefined;
  protocolCapabilities?: string | undefined;
};

/** @internal */
export const Server$outboundSchema: z.ZodType<
  Server$Outbound,
  z.ZodTypeDef,
  Server
> = z.object({
  name: z.string().optional(),
  host: z.string().optional(),
  address: z.string().optional(),
  port: z.number().optional(),
  machineIdentifier: z.string().optional(),
  version: z.string().optional(),
  protocol: z.string().optional(),
  product: z.string().optional(),
  deviceClass: z.string().optional(),
  protocolVersion: z.number().optional(),
  protocolCapabilities: 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 Server$ {
  /** @deprecated use `Server$inboundSchema` instead. */
  export const inboundSchema = Server$inboundSchema;
  /** @deprecated use `Server$outboundSchema` instead. */
  export const outboundSchema = Server$outboundSchema;
  /** @deprecated use `Server$Outbound` instead. */
  export type Outbound = Server$Outbound;
}

export function serverToJSON(server: Server): string {
  return JSON.stringify(Server$outboundSchema.parse(server));
}

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

/** @internal */
export const GetAvailableClientsMediaContainer$inboundSchema: z.ZodType<
  GetAvailableClientsMediaContainer,
  z.ZodTypeDef,
  unknown
> = z.object({
  size: z.number().optional(),
  Server: z.array(z.lazy(() => Server$inboundSchema)).optional(),
}).transform((v) => {
  return remap$(v, {
    "Server": "server",
  });
});

/** @internal */
export type GetAvailableClientsMediaContainer$Outbound = {
  size?: number | undefined;
  Server?: Array<Server$Outbound> | undefined;
};

/** @internal */
export const GetAvailableClientsMediaContainer$outboundSchema: z.ZodType<
  GetAvailableClientsMediaContainer$Outbound,
  z.ZodTypeDef,
  GetAvailableClientsMediaContainer
> = z.object({
  size: z.number().optional(),
  server: z.array(z.lazy(() => Server$outboundSchema)).optional(),
}).transform((v) => {
  return remap$(v, {
    server: "Server",
  });
});

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

export function getAvailableClientsMediaContainerToJSON(
  getAvailableClientsMediaContainer: GetAvailableClientsMediaContainer,
): string {
  return JSON.stringify(
    GetAvailableClientsMediaContainer$outboundSchema.parse(
      getAvailableClientsMediaContainer,
    ),
  );
}

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

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

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

/** @internal */
export const GetAvailableClientsResponseBody$outboundSchema: z.ZodType<
  GetAvailableClientsResponseBody$Outbound,
  z.ZodTypeDef,
  GetAvailableClientsResponseBody
> = z.object({
  mediaContainer: z.lazy(() => GetAvailableClientsMediaContainer$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 GetAvailableClientsResponseBody$ {
  /** @deprecated use `GetAvailableClientsResponseBody$inboundSchema` instead. */
  export const inboundSchema = GetAvailableClientsResponseBody$inboundSchema;
  /** @deprecated use `GetAvailableClientsResponseBody$outboundSchema` instead. */
  export const outboundSchema = GetAvailableClientsResponseBody$outboundSchema;
  /** @deprecated use `GetAvailableClientsResponseBody$Outbound` instead. */
  export type Outbound = GetAvailableClientsResponseBody$Outbound;
}

export function getAvailableClientsResponseBodyToJSON(
  getAvailableClientsResponseBody: GetAvailableClientsResponseBody,
): string {
  return JSON.stringify(
    GetAvailableClientsResponseBody$outboundSchema.parse(
      getAvailableClientsResponseBody,
    ),
  );
}

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

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

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

/** @internal */
export const GetAvailableClientsResponse$outboundSchema: z.ZodType<
  GetAvailableClientsResponse$Outbound,
  z.ZodTypeDef,
  GetAvailableClientsResponse
> = z.object({
  contentType: z.string(),
  statusCode: z.number().int(),
  rawResponse: z.instanceof(Response).transform(() => {
    throw new Error("Response cannot be serialized");
  }),
  object: z.lazy(() => GetAvailableClientsResponseBody$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 GetAvailableClientsResponse$ {
  /** @deprecated use `GetAvailableClientsResponse$inboundSchema` instead. */
  export const inboundSchema = GetAvailableClientsResponse$inboundSchema;
  /** @deprecated use `GetAvailableClientsResponse$outboundSchema` instead. */
  export const outboundSchema = GetAvailableClientsResponse$outboundSchema;
  /** @deprecated use `GetAvailableClientsResponse$Outbound` instead. */
  export type Outbound = GetAvailableClientsResponse$Outbound;
}

export function getAvailableClientsResponseToJSON(
  getAvailableClientsResponse: GetAvailableClientsResponse,
): string {
  return JSON.stringify(
    GetAvailableClientsResponse$outboundSchema.parse(
      getAvailableClientsResponse,
    ),
  );
}

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