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

import * as z from "zod";
import { remap as remap$ } from "../../../lib/primitives.js";

/**
 * Only return hubs which are "transient", meaning those which are prone to changing after media playback or addition (e.g. On Deck, or Recently Added).
 */
export enum OnlyTransient {
  Zero = 0,
  One = 1,
}

export type GetGlobalHubsRequest = {
  /**
   * The number of items to return with each hub.
   */
  count?: number | undefined;
  /**
   * Only return hubs which are "transient", meaning those which are prone to changing after media playback or addition (e.g. On Deck, or Recently Added).
   */
  onlyTransient?: OnlyTransient | undefined;
};

export type GetGlobalHubsMetadata = {
  ratingKey?: string | undefined;
  key?: string | undefined;
  guid?: string | undefined;
  type?: string | undefined;
  title?: string | undefined;
  titleSort?: string | undefined;
  summary?: string | undefined;
  smart?: boolean | undefined;
  playlistType?: string | undefined;
  composite?: string | undefined;
  icon?: string | undefined;
  viewCount?: number | undefined;
  lastViewedAt?: number | undefined;
  duration?: number | undefined;
  leafCount?: number | undefined;
  addedAt?: number | undefined;
  updatedAt?: number | undefined;
};

export type Hub = {
  hubKey?: string | undefined;
  key?: string | undefined;
  title?: string | undefined;
  type?: string | undefined;
  hubIdentifier?: string | undefined;
  context?: string | undefined;
  size?: number | undefined;
  more?: boolean | undefined;
  style?: string | undefined;
  promoted?: boolean | undefined;
  metadata?: Array<GetGlobalHubsMetadata> | undefined;
};

export type GetGlobalHubsMediaContainer = {
  size?: number | undefined;
  allowSync?: boolean | undefined;
  identifier?: string | undefined;
  hub?: Array<Hub> | undefined;
};

/**
 * returns global hubs
 */
export type GetGlobalHubsResponseBody = {
  mediaContainer?: GetGlobalHubsMediaContainer | undefined;
};

export type GetGlobalHubsResponse = {
  /**
   * 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;
  /**
   * returns global hubs
   */
  object?: GetGlobalHubsResponseBody | undefined;
};

/** @internal */
export const OnlyTransient$inboundSchema: z.ZodNativeEnum<
  typeof OnlyTransient
> = z.nativeEnum(OnlyTransient);

/** @internal */
export const OnlyTransient$outboundSchema: z.ZodNativeEnum<
  typeof OnlyTransient
> = OnlyTransient$inboundSchema;

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

/** @internal */
export const GetGlobalHubsRequest$inboundSchema: z.ZodType<
  GetGlobalHubsRequest,
  z.ZodTypeDef,
  unknown
> = z.object({
  count: z.number().optional(),
  onlyTransient: OnlyTransient$inboundSchema.optional(),
});

/** @internal */
export type GetGlobalHubsRequest$Outbound = {
  count?: number | undefined;
  onlyTransient?: number | undefined;
};

/** @internal */
export const GetGlobalHubsRequest$outboundSchema: z.ZodType<
  GetGlobalHubsRequest$Outbound,
  z.ZodTypeDef,
  GetGlobalHubsRequest
> = z.object({
  count: z.number().optional(),
  onlyTransient: OnlyTransient$outboundSchema.optional(),
});

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

/** @internal */
export const GetGlobalHubsMetadata$inboundSchema: z.ZodType<
  GetGlobalHubsMetadata,
  z.ZodTypeDef,
  unknown
> = z.object({
  ratingKey: z.string().optional(),
  key: z.string().optional(),
  guid: z.string().optional(),
  type: z.string().optional(),
  title: z.string().optional(),
  titleSort: z.string().optional(),
  summary: z.string().optional(),
  smart: z.boolean().optional(),
  playlistType: z.string().optional(),
  composite: z.string().optional(),
  icon: z.string().optional(),
  viewCount: z.number().int().optional(),
  lastViewedAt: z.number().int().optional(),
  duration: z.number().int().optional(),
  leafCount: z.number().int().optional(),
  addedAt: z.number().int().optional(),
  updatedAt: z.number().int().optional(),
});

/** @internal */
export type GetGlobalHubsMetadata$Outbound = {
  ratingKey?: string | undefined;
  key?: string | undefined;
  guid?: string | undefined;
  type?: string | undefined;
  title?: string | undefined;
  titleSort?: string | undefined;
  summary?: string | undefined;
  smart?: boolean | undefined;
  playlistType?: string | undefined;
  composite?: string | undefined;
  icon?: string | undefined;
  viewCount?: number | undefined;
  lastViewedAt?: number | undefined;
  duration?: number | undefined;
  leafCount?: number | undefined;
  addedAt?: number | undefined;
  updatedAt?: number | undefined;
};

/** @internal */
export const GetGlobalHubsMetadata$outboundSchema: z.ZodType<
  GetGlobalHubsMetadata$Outbound,
  z.ZodTypeDef,
  GetGlobalHubsMetadata
> = z.object({
  ratingKey: z.string().optional(),
  key: z.string().optional(),
  guid: z.string().optional(),
  type: z.string().optional(),
  title: z.string().optional(),
  titleSort: z.string().optional(),
  summary: z.string().optional(),
  smart: z.boolean().optional(),
  playlistType: z.string().optional(),
  composite: z.string().optional(),
  icon: z.string().optional(),
  viewCount: z.number().int().optional(),
  lastViewedAt: z.number().int().optional(),
  duration: z.number().int().optional(),
  leafCount: z.number().int().optional(),
  addedAt: z.number().int().optional(),
  updatedAt: z.number().int().optional(),
});

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

/** @internal */
export const Hub$inboundSchema: z.ZodType<Hub, z.ZodTypeDef, unknown> = z
  .object({
    hubKey: z.string().optional(),
    key: z.string().optional(),
    title: z.string().optional(),
    type: z.string().optional(),
    hubIdentifier: z.string().optional(),
    context: z.string().optional(),
    size: z.number().int().optional(),
    more: z.boolean().optional(),
    style: z.string().optional(),
    promoted: z.boolean().optional(),
    Metadata: z.array(z.lazy(() => GetGlobalHubsMetadata$inboundSchema))
      .optional(),
  }).transform((v) => {
    return remap$(v, {
      "Metadata": "metadata",
    });
  });

/** @internal */
export type Hub$Outbound = {
  hubKey?: string | undefined;
  key?: string | undefined;
  title?: string | undefined;
  type?: string | undefined;
  hubIdentifier?: string | undefined;
  context?: string | undefined;
  size?: number | undefined;
  more?: boolean | undefined;
  style?: string | undefined;
  promoted?: boolean | undefined;
  Metadata?: Array<GetGlobalHubsMetadata$Outbound> | undefined;
};

/** @internal */
export const Hub$outboundSchema: z.ZodType<Hub$Outbound, z.ZodTypeDef, Hub> = z
  .object({
    hubKey: z.string().optional(),
    key: z.string().optional(),
    title: z.string().optional(),
    type: z.string().optional(),
    hubIdentifier: z.string().optional(),
    context: z.string().optional(),
    size: z.number().int().optional(),
    more: z.boolean().optional(),
    style: z.string().optional(),
    promoted: z.boolean().optional(),
    metadata: z.array(z.lazy(() => GetGlobalHubsMetadata$outboundSchema))
      .optional(),
  }).transform((v) => {
    return remap$(v, {
      metadata: "Metadata",
    });
  });

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

/** @internal */
export const GetGlobalHubsMediaContainer$inboundSchema: z.ZodType<
  GetGlobalHubsMediaContainer,
  z.ZodTypeDef,
  unknown
> = z.object({
  size: z.number().int().optional(),
  allowSync: z.boolean().optional(),
  identifier: z.string().optional(),
  Hub: z.array(z.lazy(() => Hub$inboundSchema)).optional(),
}).transform((v) => {
  return remap$(v, {
    "Hub": "hub",
  });
});

/** @internal */
export type GetGlobalHubsMediaContainer$Outbound = {
  size?: number | undefined;
  allowSync?: boolean | undefined;
  identifier?: string | undefined;
  Hub?: Array<Hub$Outbound> | undefined;
};

/** @internal */
export const GetGlobalHubsMediaContainer$outboundSchema: z.ZodType<
  GetGlobalHubsMediaContainer$Outbound,
  z.ZodTypeDef,
  GetGlobalHubsMediaContainer
> = z.object({
  size: z.number().int().optional(),
  allowSync: z.boolean().optional(),
  identifier: z.string().optional(),
  hub: z.array(z.lazy(() => Hub$outboundSchema)).optional(),
}).transform((v) => {
  return remap$(v, {
    hub: "Hub",
  });
});

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

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

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

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

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

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

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