/*
 * 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 GetPlayQueueGlobals = {
  /**
   * Indicates the client accepts the indicated media types
   */
  accepts?: shared.Accepts | undefined;
  /**
   * An opaque identifier unique to the client
   */
  clientIdentifier?: string | undefined;
  /**
   * The name of the client product
   */
  product?: string | undefined;
  /**
   * The version of the client application
   */
  version?: string | undefined;
  /**
   * The platform of the client
   */
  platform?: string | undefined;
  /**
   * The version of the platform
   */
  platformVersion?: string | undefined;
  /**
   * A relatively friendly name for the client device
   */
  device?: string | undefined;
  /**
   * A potentially less friendly identifier for the device model
   */
  model?: string | undefined;
  /**
   * The device vendor
   */
  deviceVendor?: string | undefined;
  /**
   * A friendly name for the client
   */
  deviceName?: string | undefined;
  /**
   * The marketplace on which the client application is distributed
   */
  marketplace?: string | undefined;
};

export type GetPlayQueueRequest = {
  /**
   * Indicates the client accepts the indicated media types
   */
  accepts?: shared.Accepts | undefined;
  /**
   * An opaque identifier unique to the client
   */
  clientIdentifier?: string | undefined;
  /**
   * The name of the client product
   */
  product?: string | undefined;
  /**
   * The version of the client application
   */
  version?: string | undefined;
  /**
   * The platform of the client
   */
  platform?: string | undefined;
  /**
   * The version of the platform
   */
  platformVersion?: string | undefined;
  /**
   * A relatively friendly name for the client device
   */
  device?: string | undefined;
  /**
   * A potentially less friendly identifier for the device model
   */
  model?: string | undefined;
  /**
   * The device vendor
   */
  deviceVendor?: string | undefined;
  /**
   * A friendly name for the client
   */
  deviceName?: string | undefined;
  /**
   * The marketplace on which the client application is distributed
   */
  marketplace?: string | undefined;
  /**
   * The ID of the play queue.
   */
  playQueueId: number;
  /**
   * If the server should transfer ownership to the requesting client (used in remote control scenarios).
   */
  own?: shared.BoolInt | undefined;
  /**
   * The play queue item ID for the center of the window - this doesn't change the current selected item.
   */
  center?: string | undefined;
  /**
   * How many items on each side of the center of the window
   */
  window?: number | undefined;
  /**
   * Whether to include the items before the center (if 0, center is not included either), defaults to 1.
   */
  includeBefore?: shared.BoolInt | undefined;
  /**
   * Whether to include the items after the center (if 0, center is not included either), defaults to 1.
   */
  includeAfter?: shared.BoolInt | undefined;
};

export type GetPlayQueueResponse = {
  /**
   * 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
   */
  mediaContainerWithPlaylistMetadata?:
    | shared.MediaContainerWithPlaylistMetadata
    | undefined;
};

/** @internal */
export type GetPlayQueueRequest$Outbound = {
  accepts: string;
  "Client-Identifier"?: string | undefined;
  Product?: string | undefined;
  Version?: string | undefined;
  Platform?: string | undefined;
  "Platform-Version"?: string | undefined;
  Device?: string | undefined;
  Model?: string | undefined;
  "Device-Vendor"?: string | undefined;
  "Device-Name"?: string | undefined;
  Marketplace?: string | undefined;
  playQueueId: number;
  own: number;
  center?: string | undefined;
  window?: number | undefined;
  includeBefore: number;
  includeAfter: number;
};

/** @internal */
export const GetPlayQueueRequest$outboundSchema: z.ZodType<
  GetPlayQueueRequest$Outbound,
  z.ZodTypeDef,
  GetPlayQueueRequest
> = z.object({
  accepts: shared.Accepts$outboundSchema.default(shared.Accepts.ApplicationXml),
  clientIdentifier: z.string().optional(),
  product: z.string().optional(),
  version: z.string().optional(),
  platform: z.string().optional(),
  platformVersion: z.string().optional(),
  device: z.string().optional(),
  model: z.string().optional(),
  deviceVendor: z.string().optional(),
  deviceName: z.string().optional(),
  marketplace: z.string().optional(),
  playQueueId: z.number().int(),
  own: shared.BoolInt$outboundSchema.default(shared.BoolInt.False),
  center: z.string().optional(),
  window: z.number().int().optional(),
  includeBefore: shared.BoolInt$outboundSchema.default(shared.BoolInt.False),
  includeAfter: shared.BoolInt$outboundSchema.default(shared.BoolInt.False),
}).transform((v) => {
  return remap$(v, {
    clientIdentifier: "Client-Identifier",
    product: "Product",
    version: "Version",
    platform: "Platform",
    platformVersion: "Platform-Version",
    device: "Device",
    model: "Model",
    deviceVendor: "Device-Vendor",
    deviceName: "Device-Name",
    marketplace: "Marketplace",
  });
});

export function getPlayQueueRequestToJSON(
  getPlayQueueRequest: GetPlayQueueRequest,
): string {
  return JSON.stringify(
    GetPlayQueueRequest$outboundSchema.parse(getPlayQueueRequest),
  );
}

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

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