/*
 * 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 { RFCDate } from "../../types/rfcdate.js";
import { SDKValidationError } from "../errors/sdkvalidationerror.js";

/**
 * The type of media to retrieve or filter by.
 *
 * @remarks
 * 1 = movie
 * 2 = show
 * 3 = season
 * 4 = episode
 * E.g. A movie library will not return anything with type 3 as there are no seasons for movie libraries
 */
export enum GetAllMediaLibraryQueryParamType {
  Movie = 1,
  TvShow = 2,
  Season = 3,
  Episode = 4,
  Audio = 8,
  Album = 9,
  Track = 10,
}

/**
 * Adds the Meta object to the response
 *
 * @remarks
 */
export enum GetAllMediaLibraryQueryParamIncludeMeta {
  Disable = 0,
  Enable = 1,
}

/**
 * Adds the Guid object to the response
 *
 * @remarks
 */
export enum QueryParamIncludeGuids {
  Disable = 0,
  Enable = 1,
}

export enum IncludeAdvanced {
  Disable = 0,
  Enable = 1,
}

export enum QueryParamIncludeCollections {
  Disable = 0,
  Enable = 1,
}

export enum QueryParamIncludeExternalMedia {
  Disable = 0,
  Enable = 1,
}

export type GetAllMediaLibraryRequest = {
  /**
   * The unique key of the Plex library.
   *
   * @remarks
   * Note: This is unique in the context of the Plex server.
   */
  sectionKey: number;
  /**
   * The type of media to retrieve or filter by.
   *
   * @remarks
   * 1 = movie
   * 2 = show
   * 3 = season
   * 4 = episode
   * E.g. A movie library will not return anything with type 3 as there are no seasons for movie libraries
   */
  type: GetAllMediaLibraryQueryParamType;
  /**
   * Adds the Meta object to the response
   *
   * @remarks
   */
  includeMeta?: GetAllMediaLibraryQueryParamIncludeMeta | undefined;
  /**
   * Adds the Guid object to the response
   *
   * @remarks
   */
  includeGuids?: QueryParamIncludeGuids | undefined;
  includeAdvanced?: IncludeAdvanced | undefined;
  includeCollections?: QueryParamIncludeCollections | undefined;
  includeExternalMedia?: QueryParamIncludeExternalMedia | undefined;
  /**
   * The index of the first item to return. If not specified, the first item will be returned.
   *
   * @remarks
   * If the number of items exceeds the limit, the response will be paginated.
   * By default this is 0
   */
  xPlexContainerStart?: number | undefined;
  /**
   * The number of items to return. If not specified, all items will be returned.
   *
   * @remarks
   * If the number of items exceeds the limit, the response will be paginated.
   * By default this is 50
   */
  xPlexContainerSize?: number | undefined;
};

export type GetAllMediaLibraryFilter = {
  filter: string;
  filterType: string;
  key: string;
  title: string;
  type: string;
  advanced?: boolean | undefined;
};

/**
 * The direction of the sort. Can be either `asc` or `desc`.
 *
 * @remarks
 */
export enum GetAllMediaLibraryActiveDirection {
  Ascending = "asc",
  Descending = "desc",
}

/**
 * The direction of the sort. Can be either `asc` or `desc`.
 *
 * @remarks
 */
export enum GetAllMediaLibraryDefaultDirection {
  Ascending = "asc",
  Descending = "desc",
}

export type GetAllMediaLibrarySort = {
  default?: string | undefined;
  active?: boolean | undefined;
  /**
   * The direction of the sort. Can be either `asc` or `desc`.
   *
   * @remarks
   */
  activeDirection?: GetAllMediaLibraryActiveDirection | undefined;
  /**
   * The direction of the sort. Can be either `asc` or `desc`.
   *
   * @remarks
   */
  defaultDirection?: GetAllMediaLibraryDefaultDirection | undefined;
  descKey?: string | undefined;
  firstCharacterKey?: string | undefined;
  key: string;
  title: string;
};

export type GetAllMediaLibraryField = {
  key: string;
  title: string;
  type: string;
  subType?: string | undefined;
};

export type GetAllMediaLibraryType = {
  key: string;
  type: string;
  subtype?: string | undefined;
  title: string;
  active: boolean;
  filter?: Array<GetAllMediaLibraryFilter> | undefined;
  sort?: Array<GetAllMediaLibrarySort> | undefined;
  field?: Array<GetAllMediaLibraryField> | undefined;
};

export type GetAllMediaLibraryOperator = {
  key: string;
  title: string;
};

export type GetAllMediaLibraryFieldType = {
  type: string;
  operator: Array<GetAllMediaLibraryOperator>;
};

/**
 * The Meta object is only included in the response if the `includeMeta` parameter is set to `1`.
 *
 * @remarks
 */
export type GetAllMediaLibraryMeta = {
  type?: Array<GetAllMediaLibraryType> | undefined;
  fieldType?: Array<GetAllMediaLibraryFieldType> | undefined;
};

/**
 * The type of media content
 *
 * @remarks
 */
export enum GetAllMediaLibraryLibraryType {
  Movie = "movie",
  TvShow = "show",
  Season = "season",
  Episode = "episode",
  Artist = "artist",
  Album = "album",
}

export enum GetAllMediaLibraryLibraryResponseType {
  CoverPoster = "coverPoster",
  Background = "background",
  Snapshot = "snapshot",
  ClearLogo = "clearLogo",
}

export type GetAllMediaLibraryImage = {
  alt: string;
  type: GetAllMediaLibraryLibraryResponseType;
  url: string;
};

export type GetAllMediaLibraryUltraBlurColors = {
  topLeft: string;
  topRight: string;
  bottomRight: string;
  bottomLeft: string;
};

export enum OptimizedForStreaming1 {
  Zero = 0,
  One = 1,
}

/**
 * Has this media been optimized for streaming. NOTE: This can be 0, 1, false or true
 */
export type GetAllMediaLibraryOptimizedForStreaming =
  | OptimizedForStreaming1
  | boolean;

export enum GetAllMediaLibraryOptimizedForStreaming1 {
  Zero = 0,
  One = 1,
}

/**
 * Has this media been optimized for streaming. NOTE: This can be 0, 1, false or true
 */
export type GetAllMediaLibraryLibraryOptimizedForStreaming =
  | GetAllMediaLibraryOptimizedForStreaming1
  | boolean;

/**
 * Indicates if the part has a thumbnail.
 */
export enum GetAllMediaLibraryHasThumbnail {
  False = "0",
  True = "1",
}

export type GetAllMediaLibraryStream = {
  /**
   * Unique stream identifier.
   */
  id: number;
  /**
   * Stream type (1=video, 2=audio, 3=subtitle).
   */
  streamType: number;
  /**
   * Indicates if this stream is default.
   */
  default?: boolean | undefined;
  /**
   * Codec used by the stream.
   */
  codec: string;
  /**
   * Index of the stream.
   */
  index: number;
  /**
   * Bitrate of the stream.
   */
  bitrate?: number | undefined;
  /**
   * Language of the stream.
   */
  language?: string | undefined;
  /**
   * Language tag (e.g., en).
   */
  languageTag?: string | undefined;
  /**
   * ISO language code.
   */
  languageCode?: string | undefined;
  /**
   * Indicates whether header compression is enabled.
   */
  headerCompression?: boolean | undefined;
  /**
   * Dolby Vision BL compatibility ID.
   */
  doviblCompatID?: number | undefined;
  /**
   * Indicates if Dolby Vision BL is present.
   */
  doviblPresent?: boolean | undefined;
  /**
   * Indicates if Dolby Vision EL is present.
   */
  dovielPresent?: boolean | undefined;
  /**
   * Dolby Vision level.
   */
  doviLevel?: number | undefined;
  /**
   * Indicates if Dolby Vision is present.
   */
  doviPresent?: boolean | undefined;
  /**
   * Dolby Vision profile.
   */
  doviProfile?: number | undefined;
  /**
   * Indicates if Dolby Vision RPU is present.
   */
  dovirpuPresent?: boolean | undefined;
  /**
   * Dolby Vision version.
   */
  doviVersion?: string | undefined;
  /**
   * Bit depth of the video stream.
   */
  bitDepth?: number | undefined;
  /**
   * Chroma sample location.
   */
  chromaLocation?: string | undefined;
  /**
   * Chroma subsampling format.
   */
  chromaSubsampling?: string | undefined;
  /**
   * Coded video height.
   */
  codedHeight?: number | undefined;
  /**
   * Coded video width.
   */
  codedWidth?: number | undefined;
  closedCaptions?: boolean | undefined;
  /**
   * Color primaries used.
   */
  colorPrimaries?: string | undefined;
  /**
   * Color range (e.g., tv).
   */
  colorRange?: string | undefined;
  /**
   * Color space.
   */
  colorSpace?: string | undefined;
  /**
   * Color transfer characteristics.
   */
  colorTrc?: string | undefined;
  /**
   * Frame rate of the stream.
   */
  frameRate?: number | undefined;
  /**
   * Height of the video stream.
   */
  height?: number | undefined;
  /**
   * Video level.
   */
  level?: number | undefined;
  /**
   * Indicates if this is the original stream.
   */
  original?: boolean | undefined;
  hasScalingMatrix?: boolean | undefined;
  /**
   * Video profile.
   */
  profile?: string | undefined;
  scanType?: string | undefined;
  embeddedInVideo?: string | undefined;
  /**
   * Number of reference frames.
   */
  refFrames?: number | undefined;
  /**
   * Width of the video stream.
   */
  width?: number | undefined;
  /**
   * Display title for the stream.
   */
  displayTitle: string;
  /**
   * Extended display title for the stream.
   */
  extendedDisplayTitle: string;
  /**
   * Indicates if this stream is selected (applicable for audio streams).
   */
  selected?: boolean | undefined;
  forced?: boolean | undefined;
  /**
   * Number of audio channels (for audio streams).
   */
  channels?: number | undefined;
  /**
   * Audio channel layout.
   */
  audioChannelLayout?: string | undefined;
  /**
   * Sampling rate for the audio stream.
   */
  samplingRate?: number | undefined;
  /**
   * Indicates if the stream can auto-sync.
   */
  canAutoSync?: boolean | undefined;
  /**
   * Indicates if the stream is for the hearing impaired.
   */
  hearingImpaired?: boolean | undefined;
  /**
   * Indicates if the stream is a dub.
   */
  dub?: boolean | undefined;
  /**
   * Optional title for the stream (e.g., language variant).
   */
  title?: string | undefined;
};

export type GetAllMediaLibraryPart = {
  /**
   * Indicates if the part is accessible.
   */
  accessible?: boolean | undefined;
  /**
   * Indicates if the part exists.
   */
  exists?: boolean | undefined;
  /**
   * Unique part identifier.
   */
  id: number;
  /**
   * Key to access this part.
   */
  key: string;
  indexes?: string | undefined;
  /**
   * Duration of the part in milliseconds.
   */
  duration?: number | undefined;
  /**
   * File path for the part.
   */
  file: string;
  /**
   * File size in bytes.
   */
  size: number;
  packetLength?: number | undefined;
  /**
   * Container format of the part.
   */
  container?: string | undefined;
  /**
   * Video profile for the part.
   */
  videoProfile?: string | undefined;
  /**
   * The audio profile used for the media (e.g., DTS, Dolby Digital, etc.).
   */
  audioProfile?: string | undefined;
  has64bitOffsets?: boolean | undefined;
  /**
   * Has this media been optimized for streaming. NOTE: This can be 0, 1, false or true
   */
  optimizedForStreaming?:
    | GetAllMediaLibraryOptimizedForStreaming1
    | boolean
    | undefined;
  hasThumbnail?: GetAllMediaLibraryHasThumbnail | undefined;
  /**
   * An array of streams for this part.
   */
  stream?: Array<GetAllMediaLibraryStream> | undefined;
};

export type GetAllMediaLibraryMedia = {
  /**
   * Unique media identifier.
   */
  id: number;
  /**
   * Duration of the media in milliseconds.
   */
  duration?: number | undefined;
  /**
   * Bitrate in bits per second.
   */
  bitrate?: number | undefined;
  /**
   * Video width in pixels.
   */
  width?: number | undefined;
  /**
   * Video height in pixels.
   */
  height?: number | undefined;
  /**
   * Aspect ratio of the video.
   */
  aspectRatio?: number | undefined;
  /**
   * Number of audio channels.
   */
  audioChannels?: number | undefined;
  displayOffset?: number | undefined;
  /**
   * Audio codec used.
   */
  audioCodec?: string | undefined;
  /**
   * Video codec used.
   */
  videoCodec?: string | undefined;
  /**
   * Video resolution (e.g., 4k).
   */
  videoResolution?: string | undefined;
  /**
   * File container type.
   */
  container?: string | undefined;
  /**
   * Frame rate of the video. Values found include NTSC, PAL, 24p
   *
   * @remarks
   */
  videoFrameRate?: string | undefined;
  /**
   * Video profile (e.g., main 10).
   */
  videoProfile?: string | undefined;
  /**
   * Indicates whether voice activity is detected.
   */
  hasVoiceActivity?: boolean | undefined;
  /**
   * The audio profile used for the media (e.g., DTS, Dolby Digital, etc.).
   */
  audioProfile?: string | undefined;
  /**
   * Has this media been optimized for streaming. NOTE: This can be 0, 1, false or true
   */
  optimizedForStreaming?: OptimizedForStreaming1 | boolean | undefined;
  has64bitOffsets?: boolean | undefined;
  /**
   * An array of parts for this media item.
   */
  part?: Array<GetAllMediaLibraryPart> | undefined;
};

export type GetAllMediaLibraryGenre = {
  /**
   * The genre name of this media-item
   *
   * @remarks
   */
  tag: string;
};

export type GetAllMediaLibraryCountry = {
  /**
   * The country of origin of this media item
   */
  tag: string;
};

export type GetAllMediaLibraryDirector = {
  /**
   * The role of Director
   */
  tag: string;
};

export type GetAllMediaLibraryWriter = {
  /**
   * The role of Writer
   */
  tag: string;
};

export type GetAllMediaLibraryRole = {
  /**
   * The display tag for the actor (typically the actor's name).
   */
  tag: string;
};

export type GetAllMediaLibraryGuids = {
  /**
   * The unique identifier for the Guid. Can be imdb://tt0286347, tmdb://1763, tvdb://2337
   *
   * @remarks
   */
  id?: string | undefined;
};

export type GetAllMediaLibraryCollection = {
  /**
   * The user-made collection this media item belongs to
   */
  tag: string;
};

/**
 * Unknown
 *
 * @remarks
 */
export type GetAllMediaLibraryMetadata = {
  /**
   * The rating key (Media ID) of this media item. Note: Although this is always an integer, it is represented as a string in the API.
   */
  ratingKey: string;
  /**
   * The unique key for the media item.
   */
  key: string;
  /**
   * The globally unique identifier for the media item.
   */
  guid: string;
  /**
   * A URL‐friendly version of the media title.
   */
  slug: string;
  /**
   * The studio that produced the media item.
   */
  studio?: string | undefined;
  type: GetAllMediaLibraryLibraryType;
  /**
   * The title of the media item.
   */
  title: string;
  /**
   * The sort title used for ordering media items.
   */
  titleSort: string;
  /**
   * The content rating for the media item.
   */
  contentRating?: string | undefined;
  /**
   * A synopsis of the media item.
   */
  summary: string;
  /**
   * The critic rating for the media item.
   */
  rating: number;
  /**
   * The audience rating for the media item.
   */
  audienceRating: number;
  /**
   * The release year of the media item.
   */
  year?: number | undefined;
  /**
   * A brief tagline for the media item.
   */
  tagline: string;
  /**
   * The thumbnail image URL for the media item.
   */
  thumb: string;
  /**
   * The art image URL for the media item.
   */
  art: string;
  /**
   * The theme URL for the media item.
   */
  theme: string;
  /**
   * The index position of the media item.
   */
  index: number;
  /**
   * The number of leaf items (end nodes) under this media item.
   */
  leafCount?: number | undefined;
  /**
   * The number of leaf items that have been viewed.
   */
  viewedLeafCount?: number | undefined;
  /**
   * The number of child items associated with this media item.
   */
  childCount: number;
  /**
   * The total number of seasons (for TV shows).
   */
  seasonCount: number;
  /**
   * The duration of the media item in milliseconds.
   */
  duration: number;
  /**
   * The original release date of the media item.
   */
  originallyAvailableAt: RFCDate;
  addedAt: number;
  /**
   * Unix epoch datetime in seconds
   */
  updatedAt?: number | undefined;
  /**
   * The URL for the audience rating image.
   */
  audienceRatingImage?: string | undefined;
  /**
   * The source from which chapter data is derived.
   */
  chapterSource?: string | undefined;
  /**
   * The primary extra key associated with this media item.
   */
  primaryExtraKey?: string | undefined;
  /**
   * The original title of the media item (if different).
   */
  originalTitle?: string | undefined;
  /**
   * The rating key of the parent media item.
   */
  parentRatingKey?: string | undefined;
  /**
   * The rating key of the grandparent media item.
   */
  grandparentRatingKey?: string | undefined;
  /**
   * The GUID of the parent media item.
   */
  parentGuid?: string | undefined;
  /**
   * The GUID of the grandparent media item.
   */
  grandparentGuid?: string | undefined;
  /**
   * The slug for the grandparent media item.
   */
  grandparentSlug?: string | undefined;
  /**
   * The key of the grandparent media item.
   */
  grandparentKey?: string | undefined;
  /**
   * The key of the parent media item.
   */
  parentKey?: string | undefined;
  /**
   * The title of the grandparent media item.
   */
  grandparentTitle?: string | undefined;
  /**
   * The thumbnail URL for the grandparent media item.
   */
  grandparentThumb?: string | undefined;
  /**
   * The theme URL for the grandparent media item.
   */
  grandparentTheme?: string | undefined;
  /**
   * The art URL for the grandparent media item.
   */
  grandparentArt?: string | undefined;
  /**
   * The title of the parent media item.
   */
  parentTitle?: string | undefined;
  /**
   * The index position of the parent media item.
   */
  parentIndex?: number | undefined;
  /**
   * The thumbnail URL for the parent media item.
   */
  parentThumb?: string | undefined;
  /**
   * The URL for the rating image.
   */
  ratingImage?: string | undefined;
  /**
   * The number of times this media item has been viewed.
   */
  viewCount?: number | undefined;
  /**
   * The current playback offset (in milliseconds).
   */
  viewOffset?: number | undefined;
  /**
   * The number of times this media item has been skipped.
   */
  skipCount?: number | undefined;
  /**
   * A classification that further describes the type of media item. For example, 'clip' indicates that the item is a short video clip.
   */
  subtype?: string | undefined;
  /**
   * The Unix timestamp representing the last time the item was rated.
   */
  lastRatedAt?: number | undefined;
  /**
   * The accuracy of the creation timestamp. This value indicates the format(s) provided (for example, 'epoch,local' means both epoch and local time formats are available).
   */
  createdAtAccuracy?: string | undefined;
  /**
   * The time zone offset for the creation timestamp, represented as a string. This offset indicates the difference from UTC.
   */
  createdAtTZOffset?: string | undefined;
  /**
   * Unix timestamp for when the media item was last viewed.
   */
  lastViewedAt?: number | undefined;
  /**
   * The rating provided by a user for the item. This value is expressed as a decimal number.
   */
  userRating?: number | undefined;
  image?: Array<GetAllMediaLibraryImage> | undefined;
  ultraBlurColors?: GetAllMediaLibraryUltraBlurColors | undefined;
  media?: Array<GetAllMediaLibraryMedia> | undefined;
  genre?: Array<GetAllMediaLibraryGenre> | undefined;
  country?: Array<GetAllMediaLibraryCountry> | undefined;
  director?: Array<GetAllMediaLibraryDirector> | undefined;
  writer?: Array<GetAllMediaLibraryWriter> | undefined;
  role?: Array<GetAllMediaLibraryRole> | undefined;
  guids?: Array<GetAllMediaLibraryGuids> | undefined;
  collection?: Array<GetAllMediaLibraryCollection> | undefined;
};

export type GetAllMediaLibraryMediaContainer = {
  /**
   * Number of media items returned in this response.
   */
  size: number;
  /**
   * Total number of media items in the library.
   */
  totalSize: number;
  /**
   * Offset value for pagination.
   */
  offset: number;
  /**
   * Indicates whether syncing is allowed.
   */
  allowSync: boolean;
  /**
   * URL for the background artwork of the media container.
   */
  art: string;
  /**
   * The content type or mode.
   */
  content: string;
  /**
   * An plugin identifier for the media container.
   */
  identifier: string;
  /**
   * The unique identifier for the library section.
   */
  librarySectionID: number;
  /**
   * The title of the library section.
   */
  librarySectionTitle: string;
  /**
   * The universally unique identifier for the library section.
   */
  librarySectionUUID?: string | undefined;
  /**
   * The prefix used for media tag resource paths.
   */
  mediaTagPrefix: string;
  /**
   * The version number for media tags.
   */
  mediaTagVersion: number;
  /**
   * URL for the thumbnail image of the media container.
   */
  thumb: string;
  /**
   * Specifies whether caching is disabled.
   */
  nocache: boolean;
  /**
   * The primary title of the media container.
   */
  title1: string;
  /**
   * The secondary title of the media container.
   */
  title2: string;
  /**
   * Identifier for the view group layout.
   */
  viewGroup: string;
  /**
   * The Meta object is only included in the response if the `includeMeta` parameter is set to `1`.
   *
   * @remarks
   */
  meta?: GetAllMediaLibraryMeta | undefined;
  /**
   * An array of metadata items.
   */
  metadata?: Array<GetAllMediaLibraryMetadata> | undefined;
};

/**
 * Successful response containing media container data.
 */
export type GetAllMediaLibraryResponseBody = {
  mediaContainer?: GetAllMediaLibraryMediaContainer | undefined;
};

export type GetAllMediaLibraryResponse = {
  /**
   * 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;
  /**
   * Successful response containing media container data.
   */
  object?: GetAllMediaLibraryResponseBody | undefined;
};

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

/** @internal */
export const GetAllMediaLibraryRequest$inboundSchema: z.ZodType<
  GetAllMediaLibraryRequest,
  z.ZodTypeDef,
  unknown
> = z.object({
  sectionKey: z.number().int(),
  type: GetAllMediaLibraryQueryParamType$inboundSchema,
  includeMeta: GetAllMediaLibraryQueryParamIncludeMeta$inboundSchema,
  includeGuids: QueryParamIncludeGuids$inboundSchema,
  includeAdvanced: IncludeAdvanced$inboundSchema,
  includeCollections: QueryParamIncludeCollections$inboundSchema,
  includeExternalMedia: QueryParamIncludeExternalMedia$inboundSchema,
  "X-Plex-Container-Start": z.number().int().default(0),
  "X-Plex-Container-Size": z.number().int().default(50),
}).transform((v) => {
  return remap$(v, {
    "X-Plex-Container-Start": "xPlexContainerStart",
    "X-Plex-Container-Size": "xPlexContainerSize",
  });
});

/** @internal */
export type GetAllMediaLibraryRequest$Outbound = {
  sectionKey: number;
  type: number;
  includeMeta: number;
  includeGuids: number;
  includeAdvanced: number;
  includeCollections: number;
  includeExternalMedia: number;
  "X-Plex-Container-Start": number;
  "X-Plex-Container-Size": number;
};

/** @internal */
export const GetAllMediaLibraryRequest$outboundSchema: z.ZodType<
  GetAllMediaLibraryRequest$Outbound,
  z.ZodTypeDef,
  GetAllMediaLibraryRequest
> = z.object({
  sectionKey: z.number().int(),
  type: GetAllMediaLibraryQueryParamType$outboundSchema,
  includeMeta: GetAllMediaLibraryQueryParamIncludeMeta$outboundSchema.default(
    GetAllMediaLibraryQueryParamIncludeMeta.Disable,
  ),
  includeGuids: QueryParamIncludeGuids$outboundSchema.default(
    QueryParamIncludeGuids.Disable,
  ),
  includeAdvanced: IncludeAdvanced$outboundSchema.default(
    IncludeAdvanced.Disable,
  ),
  includeCollections: QueryParamIncludeCollections$outboundSchema.default(
    QueryParamIncludeCollections.Disable,
  ),
  includeExternalMedia: QueryParamIncludeExternalMedia$outboundSchema.default(
    QueryParamIncludeExternalMedia.Disable,
  ),
  xPlexContainerStart: z.number().int().default(0),
  xPlexContainerSize: z.number().int().default(50),
}).transform((v) => {
  return remap$(v, {
    xPlexContainerStart: "X-Plex-Container-Start",
    xPlexContainerSize: "X-Plex-Container-Size",
  });
});

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

export function getAllMediaLibraryRequestToJSON(
  getAllMediaLibraryRequest: GetAllMediaLibraryRequest,
): string {
  return JSON.stringify(
    GetAllMediaLibraryRequest$outboundSchema.parse(getAllMediaLibraryRequest),
  );
}

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

/** @internal */
export const GetAllMediaLibraryFilter$inboundSchema: z.ZodType<
  GetAllMediaLibraryFilter,
  z.ZodTypeDef,
  unknown
> = z.object({
  filter: z.string(),
  filterType: z.string(),
  key: z.string(),
  title: z.string(),
  type: z.string(),
  advanced: z.boolean().optional(),
});

/** @internal */
export type GetAllMediaLibraryFilter$Outbound = {
  filter: string;
  filterType: string;
  key: string;
  title: string;
  type: string;
  advanced?: boolean | undefined;
};

/** @internal */
export const GetAllMediaLibraryFilter$outboundSchema: z.ZodType<
  GetAllMediaLibraryFilter$Outbound,
  z.ZodTypeDef,
  GetAllMediaLibraryFilter
> = z.object({
  filter: z.string(),
  filterType: z.string(),
  key: z.string(),
  title: z.string(),
  type: z.string(),
  advanced: z.boolean().optional(),
});

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

export function getAllMediaLibraryFilterToJSON(
  getAllMediaLibraryFilter: GetAllMediaLibraryFilter,
): string {
  return JSON.stringify(
    GetAllMediaLibraryFilter$outboundSchema.parse(getAllMediaLibraryFilter),
  );
}

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

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

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

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

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

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

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

/** @internal */
export const GetAllMediaLibrarySort$inboundSchema: z.ZodType<
  GetAllMediaLibrarySort,
  z.ZodTypeDef,
  unknown
> = z.object({
  default: z.string().optional(),
  active: z.boolean().optional(),
  activeDirection: GetAllMediaLibraryActiveDirection$inboundSchema.default(
    GetAllMediaLibraryActiveDirection.Ascending,
  ),
  defaultDirection: GetAllMediaLibraryDefaultDirection$inboundSchema.default(
    GetAllMediaLibraryDefaultDirection.Ascending,
  ),
  descKey: z.string().optional(),
  firstCharacterKey: z.string().optional(),
  key: z.string(),
  title: z.string(),
});

/** @internal */
export type GetAllMediaLibrarySort$Outbound = {
  default?: string | undefined;
  active?: boolean | undefined;
  activeDirection: string;
  defaultDirection: string;
  descKey?: string | undefined;
  firstCharacterKey?: string | undefined;
  key: string;
  title: string;
};

/** @internal */
export const GetAllMediaLibrarySort$outboundSchema: z.ZodType<
  GetAllMediaLibrarySort$Outbound,
  z.ZodTypeDef,
  GetAllMediaLibrarySort
> = z.object({
  default: z.string().optional(),
  active: z.boolean().optional(),
  activeDirection: GetAllMediaLibraryActiveDirection$outboundSchema.default(
    GetAllMediaLibraryActiveDirection.Ascending,
  ),
  defaultDirection: GetAllMediaLibraryDefaultDirection$outboundSchema.default(
    GetAllMediaLibraryDefaultDirection.Ascending,
  ),
  descKey: z.string().optional(),
  firstCharacterKey: z.string().optional(),
  key: z.string(),
  title: z.string(),
});

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

export function getAllMediaLibrarySortToJSON(
  getAllMediaLibrarySort: GetAllMediaLibrarySort,
): string {
  return JSON.stringify(
    GetAllMediaLibrarySort$outboundSchema.parse(getAllMediaLibrarySort),
  );
}

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

/** @internal */
export const GetAllMediaLibraryField$inboundSchema: z.ZodType<
  GetAllMediaLibraryField,
  z.ZodTypeDef,
  unknown
> = z.object({
  key: z.string(),
  title: z.string(),
  type: z.string(),
  subType: z.string().optional(),
});

/** @internal */
export type GetAllMediaLibraryField$Outbound = {
  key: string;
  title: string;
  type: string;
  subType?: string | undefined;
};

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

export function getAllMediaLibraryFieldToJSON(
  getAllMediaLibraryField: GetAllMediaLibraryField,
): string {
  return JSON.stringify(
    GetAllMediaLibraryField$outboundSchema.parse(getAllMediaLibraryField),
  );
}

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

/** @internal */
export const GetAllMediaLibraryType$inboundSchema: z.ZodType<
  GetAllMediaLibraryType,
  z.ZodTypeDef,
  unknown
> = z.object({
  key: z.string(),
  type: z.string(),
  subtype: z.string().optional(),
  title: z.string(),
  active: z.boolean(),
  Filter: z.array(z.lazy(() => GetAllMediaLibraryFilter$inboundSchema))
    .optional(),
  Sort: z.array(z.lazy(() => GetAllMediaLibrarySort$inboundSchema)).optional(),
  Field: z.array(z.lazy(() => GetAllMediaLibraryField$inboundSchema))
    .optional(),
}).transform((v) => {
  return remap$(v, {
    "Filter": "filter",
    "Sort": "sort",
    "Field": "field",
  });
});

/** @internal */
export type GetAllMediaLibraryType$Outbound = {
  key: string;
  type: string;
  subtype?: string | undefined;
  title: string;
  active: boolean;
  Filter?: Array<GetAllMediaLibraryFilter$Outbound> | undefined;
  Sort?: Array<GetAllMediaLibrarySort$Outbound> | undefined;
  Field?: Array<GetAllMediaLibraryField$Outbound> | undefined;
};

/** @internal */
export const GetAllMediaLibraryType$outboundSchema: z.ZodType<
  GetAllMediaLibraryType$Outbound,
  z.ZodTypeDef,
  GetAllMediaLibraryType
> = z.object({
  key: z.string(),
  type: z.string(),
  subtype: z.string().optional(),
  title: z.string(),
  active: z.boolean(),
  filter: z.array(z.lazy(() => GetAllMediaLibraryFilter$outboundSchema))
    .optional(),
  sort: z.array(z.lazy(() => GetAllMediaLibrarySort$outboundSchema)).optional(),
  field: z.array(z.lazy(() => GetAllMediaLibraryField$outboundSchema))
    .optional(),
}).transform((v) => {
  return remap$(v, {
    filter: "Filter",
    sort: "Sort",
    field: "Field",
  });
});

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

export function getAllMediaLibraryTypeToJSON(
  getAllMediaLibraryType: GetAllMediaLibraryType,
): string {
  return JSON.stringify(
    GetAllMediaLibraryType$outboundSchema.parse(getAllMediaLibraryType),
  );
}

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

/** @internal */
export const GetAllMediaLibraryOperator$inboundSchema: z.ZodType<
  GetAllMediaLibraryOperator,
  z.ZodTypeDef,
  unknown
> = z.object({
  key: z.string(),
  title: z.string(),
});

/** @internal */
export type GetAllMediaLibraryOperator$Outbound = {
  key: string;
  title: string;
};

/** @internal */
export const GetAllMediaLibraryOperator$outboundSchema: z.ZodType<
  GetAllMediaLibraryOperator$Outbound,
  z.ZodTypeDef,
  GetAllMediaLibraryOperator
> = z.object({
  key: z.string(),
  title: z.string(),
});

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

export function getAllMediaLibraryOperatorToJSON(
  getAllMediaLibraryOperator: GetAllMediaLibraryOperator,
): string {
  return JSON.stringify(
    GetAllMediaLibraryOperator$outboundSchema.parse(getAllMediaLibraryOperator),
  );
}

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

/** @internal */
export const GetAllMediaLibraryFieldType$inboundSchema: z.ZodType<
  GetAllMediaLibraryFieldType,
  z.ZodTypeDef,
  unknown
> = z.object({
  type: z.string(),
  Operator: z.array(z.lazy(() => GetAllMediaLibraryOperator$inboundSchema)),
}).transform((v) => {
  return remap$(v, {
    "Operator": "operator",
  });
});

/** @internal */
export type GetAllMediaLibraryFieldType$Outbound = {
  type: string;
  Operator: Array<GetAllMediaLibraryOperator$Outbound>;
};

/** @internal */
export const GetAllMediaLibraryFieldType$outboundSchema: z.ZodType<
  GetAllMediaLibraryFieldType$Outbound,
  z.ZodTypeDef,
  GetAllMediaLibraryFieldType
> = z.object({
  type: z.string(),
  operator: z.array(z.lazy(() => GetAllMediaLibraryOperator$outboundSchema)),
}).transform((v) => {
  return remap$(v, {
    operator: "Operator",
  });
});

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

export function getAllMediaLibraryFieldTypeToJSON(
  getAllMediaLibraryFieldType: GetAllMediaLibraryFieldType,
): string {
  return JSON.stringify(
    GetAllMediaLibraryFieldType$outboundSchema.parse(
      getAllMediaLibraryFieldType,
    ),
  );
}

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

/** @internal */
export const GetAllMediaLibraryMeta$inboundSchema: z.ZodType<
  GetAllMediaLibraryMeta,
  z.ZodTypeDef,
  unknown
> = z.object({
  Type: z.array(z.lazy(() => GetAllMediaLibraryType$inboundSchema)).optional(),
  FieldType: z.array(z.lazy(() => GetAllMediaLibraryFieldType$inboundSchema))
    .optional(),
}).transform((v) => {
  return remap$(v, {
    "Type": "type",
    "FieldType": "fieldType",
  });
});

/** @internal */
export type GetAllMediaLibraryMeta$Outbound = {
  Type?: Array<GetAllMediaLibraryType$Outbound> | undefined;
  FieldType?: Array<GetAllMediaLibraryFieldType$Outbound> | undefined;
};

/** @internal */
export const GetAllMediaLibraryMeta$outboundSchema: z.ZodType<
  GetAllMediaLibraryMeta$Outbound,
  z.ZodTypeDef,
  GetAllMediaLibraryMeta
> = z.object({
  type: z.array(z.lazy(() => GetAllMediaLibraryType$outboundSchema)).optional(),
  fieldType: z.array(z.lazy(() => GetAllMediaLibraryFieldType$outboundSchema))
    .optional(),
}).transform((v) => {
  return remap$(v, {
    type: "Type",
    fieldType: "FieldType",
  });
});

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

export function getAllMediaLibraryMetaToJSON(
  getAllMediaLibraryMeta: GetAllMediaLibraryMeta,
): string {
  return JSON.stringify(
    GetAllMediaLibraryMeta$outboundSchema.parse(getAllMediaLibraryMeta),
  );
}

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

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

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

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

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

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

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

/** @internal */
export const GetAllMediaLibraryImage$inboundSchema: z.ZodType<
  GetAllMediaLibraryImage,
  z.ZodTypeDef,
  unknown
> = z.object({
  alt: z.string(),
  type: GetAllMediaLibraryLibraryResponseType$inboundSchema,
  url: z.string(),
});

/** @internal */
export type GetAllMediaLibraryImage$Outbound = {
  alt: string;
  type: string;
  url: string;
};

/** @internal */
export const GetAllMediaLibraryImage$outboundSchema: z.ZodType<
  GetAllMediaLibraryImage$Outbound,
  z.ZodTypeDef,
  GetAllMediaLibraryImage
> = z.object({
  alt: z.string(),
  type: GetAllMediaLibraryLibraryResponseType$outboundSchema,
  url: z.string(),
});

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

export function getAllMediaLibraryImageToJSON(
  getAllMediaLibraryImage: GetAllMediaLibraryImage,
): string {
  return JSON.stringify(
    GetAllMediaLibraryImage$outboundSchema.parse(getAllMediaLibraryImage),
  );
}

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

/** @internal */
export const GetAllMediaLibraryUltraBlurColors$inboundSchema: z.ZodType<
  GetAllMediaLibraryUltraBlurColors,
  z.ZodTypeDef,
  unknown
> = z.object({
  topLeft: z.string(),
  topRight: z.string(),
  bottomRight: z.string(),
  bottomLeft: z.string(),
});

/** @internal */
export type GetAllMediaLibraryUltraBlurColors$Outbound = {
  topLeft: string;
  topRight: string;
  bottomRight: string;
  bottomLeft: string;
};

/** @internal */
export const GetAllMediaLibraryUltraBlurColors$outboundSchema: z.ZodType<
  GetAllMediaLibraryUltraBlurColors$Outbound,
  z.ZodTypeDef,
  GetAllMediaLibraryUltraBlurColors
> = z.object({
  topLeft: z.string(),
  topRight: z.string(),
  bottomRight: z.string(),
  bottomLeft: z.string(),
});

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

export function getAllMediaLibraryUltraBlurColorsToJSON(
  getAllMediaLibraryUltraBlurColors: GetAllMediaLibraryUltraBlurColors,
): string {
  return JSON.stringify(
    GetAllMediaLibraryUltraBlurColors$outboundSchema.parse(
      getAllMediaLibraryUltraBlurColors,
    ),
  );
}

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

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

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

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

/** @internal */
export const GetAllMediaLibraryOptimizedForStreaming$inboundSchema: z.ZodType<
  GetAllMediaLibraryOptimizedForStreaming,
  z.ZodTypeDef,
  unknown
> = z.union([OptimizedForStreaming1$inboundSchema, z.boolean()]);

/** @internal */
export type GetAllMediaLibraryOptimizedForStreaming$Outbound = number | boolean;

/** @internal */
export const GetAllMediaLibraryOptimizedForStreaming$outboundSchema: z.ZodType<
  GetAllMediaLibraryOptimizedForStreaming$Outbound,
  z.ZodTypeDef,
  GetAllMediaLibraryOptimizedForStreaming
> = z.union([OptimizedForStreaming1$outboundSchema, z.boolean()]);

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

export function getAllMediaLibraryOptimizedForStreamingToJSON(
  getAllMediaLibraryOptimizedForStreaming:
    GetAllMediaLibraryOptimizedForStreaming,
): string {
  return JSON.stringify(
    GetAllMediaLibraryOptimizedForStreaming$outboundSchema.parse(
      getAllMediaLibraryOptimizedForStreaming,
    ),
  );
}

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

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

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

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

/** @internal */
export const GetAllMediaLibraryLibraryOptimizedForStreaming$inboundSchema:
  z.ZodType<
    GetAllMediaLibraryLibraryOptimizedForStreaming,
    z.ZodTypeDef,
    unknown
  > = z.union([
    GetAllMediaLibraryOptimizedForStreaming1$inboundSchema,
    z.boolean(),
  ]);

/** @internal */
export type GetAllMediaLibraryLibraryOptimizedForStreaming$Outbound =
  | number
  | boolean;

/** @internal */
export const GetAllMediaLibraryLibraryOptimizedForStreaming$outboundSchema:
  z.ZodType<
    GetAllMediaLibraryLibraryOptimizedForStreaming$Outbound,
    z.ZodTypeDef,
    GetAllMediaLibraryLibraryOptimizedForStreaming
  > = z.union([
    GetAllMediaLibraryOptimizedForStreaming1$outboundSchema,
    z.boolean(),
  ]);

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

export function getAllMediaLibraryLibraryOptimizedForStreamingToJSON(
  getAllMediaLibraryLibraryOptimizedForStreaming:
    GetAllMediaLibraryLibraryOptimizedForStreaming,
): string {
  return JSON.stringify(
    GetAllMediaLibraryLibraryOptimizedForStreaming$outboundSchema.parse(
      getAllMediaLibraryLibraryOptimizedForStreaming,
    ),
  );
}

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

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

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

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

/** @internal */
export const GetAllMediaLibraryStream$inboundSchema: z.ZodType<
  GetAllMediaLibraryStream,
  z.ZodTypeDef,
  unknown
> = z.object({
  id: z.number().int(),
  streamType: z.number().int(),
  default: z.boolean().optional(),
  codec: z.string(),
  index: z.number().int(),
  bitrate: z.number().int().optional(),
  language: z.string().optional(),
  languageTag: z.string().optional(),
  languageCode: z.string().optional(),
  headerCompression: z.boolean().optional(),
  DOVIBLCompatID: z.number().int().optional(),
  DOVIBLPresent: z.boolean().optional(),
  DOVIELPresent: z.boolean().optional(),
  DOVILevel: z.number().int().optional(),
  DOVIPresent: z.boolean().optional(),
  DOVIProfile: z.number().int().optional(),
  DOVIRPUPresent: z.boolean().optional(),
  DOVIVersion: z.string().optional(),
  bitDepth: z.number().int().optional(),
  chromaLocation: z.string().optional(),
  chromaSubsampling: z.string().optional(),
  codedHeight: z.number().int().optional(),
  codedWidth: z.number().int().optional(),
  closedCaptions: z.boolean().optional(),
  colorPrimaries: z.string().optional(),
  colorRange: z.string().optional(),
  colorSpace: z.string().optional(),
  colorTrc: z.string().optional(),
  frameRate: z.number().optional(),
  height: z.number().int().optional(),
  level: z.number().int().optional(),
  original: z.boolean().optional(),
  hasScalingMatrix: z.boolean().optional(),
  profile: z.string().optional(),
  scanType: z.string().optional(),
  embeddedInVideo: z.string().optional(),
  refFrames: z.number().int().optional(),
  width: z.number().int().optional(),
  displayTitle: z.string(),
  extendedDisplayTitle: z.string(),
  selected: z.boolean().optional(),
  forced: z.boolean().optional(),
  channels: z.number().int().optional(),
  audioChannelLayout: z.string().optional(),
  samplingRate: z.number().int().optional(),
  canAutoSync: z.boolean().optional(),
  hearingImpaired: z.boolean().optional(),
  dub: z.boolean().optional(),
  title: z.string().optional(),
}).transform((v) => {
  return remap$(v, {
    "DOVIBLCompatID": "doviblCompatID",
    "DOVIBLPresent": "doviblPresent",
    "DOVIELPresent": "dovielPresent",
    "DOVILevel": "doviLevel",
    "DOVIPresent": "doviPresent",
    "DOVIProfile": "doviProfile",
    "DOVIRPUPresent": "dovirpuPresent",
    "DOVIVersion": "doviVersion",
  });
});

/** @internal */
export type GetAllMediaLibraryStream$Outbound = {
  id: number;
  streamType: number;
  default?: boolean | undefined;
  codec: string;
  index: number;
  bitrate?: number | undefined;
  language?: string | undefined;
  languageTag?: string | undefined;
  languageCode?: string | undefined;
  headerCompression?: boolean | undefined;
  DOVIBLCompatID?: number | undefined;
  DOVIBLPresent?: boolean | undefined;
  DOVIELPresent?: boolean | undefined;
  DOVILevel?: number | undefined;
  DOVIPresent?: boolean | undefined;
  DOVIProfile?: number | undefined;
  DOVIRPUPresent?: boolean | undefined;
  DOVIVersion?: string | undefined;
  bitDepth?: number | undefined;
  chromaLocation?: string | undefined;
  chromaSubsampling?: string | undefined;
  codedHeight?: number | undefined;
  codedWidth?: number | undefined;
  closedCaptions?: boolean | undefined;
  colorPrimaries?: string | undefined;
  colorRange?: string | undefined;
  colorSpace?: string | undefined;
  colorTrc?: string | undefined;
  frameRate?: number | undefined;
  height?: number | undefined;
  level?: number | undefined;
  original?: boolean | undefined;
  hasScalingMatrix?: boolean | undefined;
  profile?: string | undefined;
  scanType?: string | undefined;
  embeddedInVideo?: string | undefined;
  refFrames?: number | undefined;
  width?: number | undefined;
  displayTitle: string;
  extendedDisplayTitle: string;
  selected?: boolean | undefined;
  forced?: boolean | undefined;
  channels?: number | undefined;
  audioChannelLayout?: string | undefined;
  samplingRate?: number | undefined;
  canAutoSync?: boolean | undefined;
  hearingImpaired?: boolean | undefined;
  dub?: boolean | undefined;
  title?: string | undefined;
};

/** @internal */
export const GetAllMediaLibraryStream$outboundSchema: z.ZodType<
  GetAllMediaLibraryStream$Outbound,
  z.ZodTypeDef,
  GetAllMediaLibraryStream
> = z.object({
  id: z.number().int(),
  streamType: z.number().int(),
  default: z.boolean().optional(),
  codec: z.string(),
  index: z.number().int(),
  bitrate: z.number().int().optional(),
  language: z.string().optional(),
  languageTag: z.string().optional(),
  languageCode: z.string().optional(),
  headerCompression: z.boolean().optional(),
  doviblCompatID: z.number().int().optional(),
  doviblPresent: z.boolean().optional(),
  dovielPresent: z.boolean().optional(),
  doviLevel: z.number().int().optional(),
  doviPresent: z.boolean().optional(),
  doviProfile: z.number().int().optional(),
  dovirpuPresent: z.boolean().optional(),
  doviVersion: z.string().optional(),
  bitDepth: z.number().int().optional(),
  chromaLocation: z.string().optional(),
  chromaSubsampling: z.string().optional(),
  codedHeight: z.number().int().optional(),
  codedWidth: z.number().int().optional(),
  closedCaptions: z.boolean().optional(),
  colorPrimaries: z.string().optional(),
  colorRange: z.string().optional(),
  colorSpace: z.string().optional(),
  colorTrc: z.string().optional(),
  frameRate: z.number().optional(),
  height: z.number().int().optional(),
  level: z.number().int().optional(),
  original: z.boolean().optional(),
  hasScalingMatrix: z.boolean().optional(),
  profile: z.string().optional(),
  scanType: z.string().optional(),
  embeddedInVideo: z.string().optional(),
  refFrames: z.number().int().optional(),
  width: z.number().int().optional(),
  displayTitle: z.string(),
  extendedDisplayTitle: z.string(),
  selected: z.boolean().optional(),
  forced: z.boolean().optional(),
  channels: z.number().int().optional(),
  audioChannelLayout: z.string().optional(),
  samplingRate: z.number().int().optional(),
  canAutoSync: z.boolean().optional(),
  hearingImpaired: z.boolean().optional(),
  dub: z.boolean().optional(),
  title: z.string().optional(),
}).transform((v) => {
  return remap$(v, {
    doviblCompatID: "DOVIBLCompatID",
    doviblPresent: "DOVIBLPresent",
    dovielPresent: "DOVIELPresent",
    doviLevel: "DOVILevel",
    doviPresent: "DOVIPresent",
    doviProfile: "DOVIProfile",
    dovirpuPresent: "DOVIRPUPresent",
    doviVersion: "DOVIVersion",
  });
});

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

export function getAllMediaLibraryStreamToJSON(
  getAllMediaLibraryStream: GetAllMediaLibraryStream,
): string {
  return JSON.stringify(
    GetAllMediaLibraryStream$outboundSchema.parse(getAllMediaLibraryStream),
  );
}

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

/** @internal */
export const GetAllMediaLibraryPart$inboundSchema: z.ZodType<
  GetAllMediaLibraryPart,
  z.ZodTypeDef,
  unknown
> = z.object({
  accessible: z.boolean().optional(),
  exists: z.boolean().optional(),
  id: z.number().int(),
  key: z.string(),
  indexes: z.string().optional(),
  duration: z.number().int().optional(),
  file: z.string(),
  size: z.number().int(),
  packetLength: z.number().int().optional(),
  container: z.string().optional(),
  videoProfile: z.string().optional(),
  audioProfile: z.string().optional(),
  has64bitOffsets: z.boolean().optional(),
  optimizedForStreaming: z.union([
    GetAllMediaLibraryOptimizedForStreaming1$inboundSchema,
    z.boolean(),
  ]).optional(),
  hasThumbnail: GetAllMediaLibraryHasThumbnail$inboundSchema.default(
    GetAllMediaLibraryHasThumbnail.False,
  ),
  Stream: z.array(z.lazy(() => GetAllMediaLibraryStream$inboundSchema))
    .optional(),
}).transform((v) => {
  return remap$(v, {
    "Stream": "stream",
  });
});

/** @internal */
export type GetAllMediaLibraryPart$Outbound = {
  accessible?: boolean | undefined;
  exists?: boolean | undefined;
  id: number;
  key: string;
  indexes?: string | undefined;
  duration?: number | undefined;
  file: string;
  size: number;
  packetLength?: number | undefined;
  container?: string | undefined;
  videoProfile?: string | undefined;
  audioProfile?: string | undefined;
  has64bitOffsets?: boolean | undefined;
  optimizedForStreaming?: number | boolean | undefined;
  hasThumbnail: string;
  Stream?: Array<GetAllMediaLibraryStream$Outbound> | undefined;
};

/** @internal */
export const GetAllMediaLibraryPart$outboundSchema: z.ZodType<
  GetAllMediaLibraryPart$Outbound,
  z.ZodTypeDef,
  GetAllMediaLibraryPart
> = z.object({
  accessible: z.boolean().optional(),
  exists: z.boolean().optional(),
  id: z.number().int(),
  key: z.string(),
  indexes: z.string().optional(),
  duration: z.number().int().optional(),
  file: z.string(),
  size: z.number().int(),
  packetLength: z.number().int().optional(),
  container: z.string().optional(),
  videoProfile: z.string().optional(),
  audioProfile: z.string().optional(),
  has64bitOffsets: z.boolean().optional(),
  optimizedForStreaming: z.union([
    GetAllMediaLibraryOptimizedForStreaming1$outboundSchema,
    z.boolean(),
  ]).optional(),
  hasThumbnail: GetAllMediaLibraryHasThumbnail$outboundSchema.default(
    GetAllMediaLibraryHasThumbnail.False,
  ),
  stream: z.array(z.lazy(() => GetAllMediaLibraryStream$outboundSchema))
    .optional(),
}).transform((v) => {
  return remap$(v, {
    stream: "Stream",
  });
});

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

export function getAllMediaLibraryPartToJSON(
  getAllMediaLibraryPart: GetAllMediaLibraryPart,
): string {
  return JSON.stringify(
    GetAllMediaLibraryPart$outboundSchema.parse(getAllMediaLibraryPart),
  );
}

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

/** @internal */
export const GetAllMediaLibraryMedia$inboundSchema: z.ZodType<
  GetAllMediaLibraryMedia,
  z.ZodTypeDef,
  unknown
> = z.object({
  id: z.number().int(),
  duration: z.number().int().optional(),
  bitrate: z.number().int().optional(),
  width: z.number().int().optional(),
  height: z.number().int().optional(),
  aspectRatio: z.number().optional(),
  audioChannels: z.number().int().optional(),
  displayOffset: z.number().int().optional(),
  audioCodec: z.string().optional(),
  videoCodec: z.string().optional(),
  videoResolution: z.string().optional(),
  container: z.string().optional(),
  videoFrameRate: z.string().optional(),
  videoProfile: z.string().optional(),
  hasVoiceActivity: z.boolean().optional(),
  audioProfile: z.string().optional(),
  optimizedForStreaming: z.union([
    OptimizedForStreaming1$inboundSchema,
    z.boolean(),
  ]).optional(),
  has64bitOffsets: z.boolean().optional(),
  Part: z.array(z.lazy(() => GetAllMediaLibraryPart$inboundSchema)).optional(),
}).transform((v) => {
  return remap$(v, {
    "Part": "part",
  });
});

/** @internal */
export type GetAllMediaLibraryMedia$Outbound = {
  id: number;
  duration?: number | undefined;
  bitrate?: number | undefined;
  width?: number | undefined;
  height?: number | undefined;
  aspectRatio?: number | undefined;
  audioChannels?: number | undefined;
  displayOffset?: number | undefined;
  audioCodec?: string | undefined;
  videoCodec?: string | undefined;
  videoResolution?: string | undefined;
  container?: string | undefined;
  videoFrameRate?: string | undefined;
  videoProfile?: string | undefined;
  hasVoiceActivity?: boolean | undefined;
  audioProfile?: string | undefined;
  optimizedForStreaming?: number | boolean | undefined;
  has64bitOffsets?: boolean | undefined;
  Part?: Array<GetAllMediaLibraryPart$Outbound> | undefined;
};

/** @internal */
export const GetAllMediaLibraryMedia$outboundSchema: z.ZodType<
  GetAllMediaLibraryMedia$Outbound,
  z.ZodTypeDef,
  GetAllMediaLibraryMedia
> = z.object({
  id: z.number().int(),
  duration: z.number().int().optional(),
  bitrate: z.number().int().optional(),
  width: z.number().int().optional(),
  height: z.number().int().optional(),
  aspectRatio: z.number().optional(),
  audioChannels: z.number().int().optional(),
  displayOffset: z.number().int().optional(),
  audioCodec: z.string().optional(),
  videoCodec: z.string().optional(),
  videoResolution: z.string().optional(),
  container: z.string().optional(),
  videoFrameRate: z.string().optional(),
  videoProfile: z.string().optional(),
  hasVoiceActivity: z.boolean().optional(),
  audioProfile: z.string().optional(),
  optimizedForStreaming: z.union([
    OptimizedForStreaming1$outboundSchema,
    z.boolean(),
  ]).optional(),
  has64bitOffsets: z.boolean().optional(),
  part: z.array(z.lazy(() => GetAllMediaLibraryPart$outboundSchema)).optional(),
}).transform((v) => {
  return remap$(v, {
    part: "Part",
  });
});

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

export function getAllMediaLibraryMediaToJSON(
  getAllMediaLibraryMedia: GetAllMediaLibraryMedia,
): string {
  return JSON.stringify(
    GetAllMediaLibraryMedia$outboundSchema.parse(getAllMediaLibraryMedia),
  );
}

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

/** @internal */
export const GetAllMediaLibraryGenre$inboundSchema: z.ZodType<
  GetAllMediaLibraryGenre,
  z.ZodTypeDef,
  unknown
> = z.object({
  tag: z.string(),
});

/** @internal */
export type GetAllMediaLibraryGenre$Outbound = {
  tag: string;
};

/** @internal */
export const GetAllMediaLibraryGenre$outboundSchema: z.ZodType<
  GetAllMediaLibraryGenre$Outbound,
  z.ZodTypeDef,
  GetAllMediaLibraryGenre
> = z.object({
  tag: z.string(),
});

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

export function getAllMediaLibraryGenreToJSON(
  getAllMediaLibraryGenre: GetAllMediaLibraryGenre,
): string {
  return JSON.stringify(
    GetAllMediaLibraryGenre$outboundSchema.parse(getAllMediaLibraryGenre),
  );
}

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

/** @internal */
export const GetAllMediaLibraryCountry$inboundSchema: z.ZodType<
  GetAllMediaLibraryCountry,
  z.ZodTypeDef,
  unknown
> = z.object({
  tag: z.string(),
});

/** @internal */
export type GetAllMediaLibraryCountry$Outbound = {
  tag: string;
};

/** @internal */
export const GetAllMediaLibraryCountry$outboundSchema: z.ZodType<
  GetAllMediaLibraryCountry$Outbound,
  z.ZodTypeDef,
  GetAllMediaLibraryCountry
> = z.object({
  tag: z.string(),
});

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

export function getAllMediaLibraryCountryToJSON(
  getAllMediaLibraryCountry: GetAllMediaLibraryCountry,
): string {
  return JSON.stringify(
    GetAllMediaLibraryCountry$outboundSchema.parse(getAllMediaLibraryCountry),
  );
}

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

/** @internal */
export const GetAllMediaLibraryDirector$inboundSchema: z.ZodType<
  GetAllMediaLibraryDirector,
  z.ZodTypeDef,
  unknown
> = z.object({
  tag: z.string(),
});

/** @internal */
export type GetAllMediaLibraryDirector$Outbound = {
  tag: string;
};

/** @internal */
export const GetAllMediaLibraryDirector$outboundSchema: z.ZodType<
  GetAllMediaLibraryDirector$Outbound,
  z.ZodTypeDef,
  GetAllMediaLibraryDirector
> = z.object({
  tag: z.string(),
});

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

export function getAllMediaLibraryDirectorToJSON(
  getAllMediaLibraryDirector: GetAllMediaLibraryDirector,
): string {
  return JSON.stringify(
    GetAllMediaLibraryDirector$outboundSchema.parse(getAllMediaLibraryDirector),
  );
}

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

/** @internal */
export const GetAllMediaLibraryWriter$inboundSchema: z.ZodType<
  GetAllMediaLibraryWriter,
  z.ZodTypeDef,
  unknown
> = z.object({
  tag: z.string(),
});

/** @internal */
export type GetAllMediaLibraryWriter$Outbound = {
  tag: string;
};

/** @internal */
export const GetAllMediaLibraryWriter$outboundSchema: z.ZodType<
  GetAllMediaLibraryWriter$Outbound,
  z.ZodTypeDef,
  GetAllMediaLibraryWriter
> = z.object({
  tag: z.string(),
});

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

export function getAllMediaLibraryWriterToJSON(
  getAllMediaLibraryWriter: GetAllMediaLibraryWriter,
): string {
  return JSON.stringify(
    GetAllMediaLibraryWriter$outboundSchema.parse(getAllMediaLibraryWriter),
  );
}

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

/** @internal */
export const GetAllMediaLibraryRole$inboundSchema: z.ZodType<
  GetAllMediaLibraryRole,
  z.ZodTypeDef,
  unknown
> = z.object({
  tag: z.string(),
});

/** @internal */
export type GetAllMediaLibraryRole$Outbound = {
  tag: string;
};

/** @internal */
export const GetAllMediaLibraryRole$outboundSchema: z.ZodType<
  GetAllMediaLibraryRole$Outbound,
  z.ZodTypeDef,
  GetAllMediaLibraryRole
> = z.object({
  tag: z.string(),
});

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

export function getAllMediaLibraryRoleToJSON(
  getAllMediaLibraryRole: GetAllMediaLibraryRole,
): string {
  return JSON.stringify(
    GetAllMediaLibraryRole$outboundSchema.parse(getAllMediaLibraryRole),
  );
}

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

/** @internal */
export const GetAllMediaLibraryGuids$inboundSchema: z.ZodType<
  GetAllMediaLibraryGuids,
  z.ZodTypeDef,
  unknown
> = z.object({
  id: z.string().optional(),
});

/** @internal */
export type GetAllMediaLibraryGuids$Outbound = {
  id?: string | undefined;
};

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

export function getAllMediaLibraryGuidsToJSON(
  getAllMediaLibraryGuids: GetAllMediaLibraryGuids,
): string {
  return JSON.stringify(
    GetAllMediaLibraryGuids$outboundSchema.parse(getAllMediaLibraryGuids),
  );
}

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

/** @internal */
export const GetAllMediaLibraryCollection$inboundSchema: z.ZodType<
  GetAllMediaLibraryCollection,
  z.ZodTypeDef,
  unknown
> = z.object({
  tag: z.string(),
});

/** @internal */
export type GetAllMediaLibraryCollection$Outbound = {
  tag: string;
};

/** @internal */
export const GetAllMediaLibraryCollection$outboundSchema: z.ZodType<
  GetAllMediaLibraryCollection$Outbound,
  z.ZodTypeDef,
  GetAllMediaLibraryCollection
> = z.object({
  tag: z.string(),
});

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

export function getAllMediaLibraryCollectionToJSON(
  getAllMediaLibraryCollection: GetAllMediaLibraryCollection,
): string {
  return JSON.stringify(
    GetAllMediaLibraryCollection$outboundSchema.parse(
      getAllMediaLibraryCollection,
    ),
  );
}

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

/** @internal */
export const GetAllMediaLibraryMetadata$inboundSchema: z.ZodType<
  GetAllMediaLibraryMetadata,
  z.ZodTypeDef,
  unknown
> = z.object({
  ratingKey: z.string(),
  key: z.string(),
  guid: z.string(),
  slug: z.string(),
  studio: z.string().optional(),
  type: GetAllMediaLibraryLibraryType$inboundSchema,
  title: z.string(),
  titleSort: z.string(),
  contentRating: z.string().optional(),
  summary: z.string(),
  rating: z.number(),
  audienceRating: z.number(),
  year: z.number().int().optional(),
  tagline: z.string(),
  thumb: z.string(),
  art: z.string(),
  theme: z.string(),
  index: z.number().int(),
  leafCount: z.number().int().optional(),
  viewedLeafCount: z.number().int().optional(),
  childCount: z.number().int(),
  seasonCount: z.number().int(),
  duration: z.number().int(),
  originallyAvailableAt: z.string().transform(v => new RFCDate(v)),
  addedAt: z.number().int(),
  updatedAt: z.number().int().optional(),
  audienceRatingImage: z.string().optional(),
  chapterSource: z.string().optional(),
  primaryExtraKey: z.string().optional(),
  originalTitle: z.string().optional(),
  parentRatingKey: z.string().optional(),
  grandparentRatingKey: z.string().optional(),
  parentGuid: z.string().optional(),
  grandparentGuid: z.string().optional(),
  grandparentSlug: z.string().optional(),
  grandparentKey: z.string().optional(),
  parentKey: z.string().optional(),
  grandparentTitle: z.string().optional(),
  grandparentThumb: z.string().optional(),
  grandparentTheme: z.string().optional(),
  grandparentArt: z.string().optional(),
  parentTitle: z.string().optional(),
  parentIndex: z.number().int().optional(),
  parentThumb: z.string().optional(),
  ratingImage: z.string().optional(),
  viewCount: z.number().int().optional(),
  viewOffset: z.number().int().optional(),
  skipCount: z.number().int().optional(),
  subtype: z.string().optional(),
  lastRatedAt: z.number().int().optional(),
  createdAtAccuracy: z.string().optional(),
  createdAtTZOffset: z.string().optional(),
  lastViewedAt: z.number().int().optional(),
  userRating: z.number().optional(),
  Image: z.array(z.lazy(() => GetAllMediaLibraryImage$inboundSchema))
    .optional(),
  UltraBlurColors: z.lazy(() => GetAllMediaLibraryUltraBlurColors$inboundSchema)
    .optional(),
  Media: z.array(z.lazy(() => GetAllMediaLibraryMedia$inboundSchema))
    .optional(),
  Genre: z.array(z.lazy(() => GetAllMediaLibraryGenre$inboundSchema))
    .optional(),
  Country: z.array(z.lazy(() => GetAllMediaLibraryCountry$inboundSchema))
    .optional(),
  Director: z.array(z.lazy(() => GetAllMediaLibraryDirector$inboundSchema))
    .optional(),
  Writer: z.array(z.lazy(() => GetAllMediaLibraryWriter$inboundSchema))
    .optional(),
  Role: z.array(z.lazy(() => GetAllMediaLibraryRole$inboundSchema)).optional(),
  Guid: z.array(z.lazy(() => GetAllMediaLibraryGuids$inboundSchema)).optional(),
  Collection: z.array(z.lazy(() => GetAllMediaLibraryCollection$inboundSchema))
    .optional(),
}).transform((v) => {
  return remap$(v, {
    "Image": "image",
    "UltraBlurColors": "ultraBlurColors",
    "Media": "media",
    "Genre": "genre",
    "Country": "country",
    "Director": "director",
    "Writer": "writer",
    "Role": "role",
    "Guid": "guids",
    "Collection": "collection",
  });
});

/** @internal */
export type GetAllMediaLibraryMetadata$Outbound = {
  ratingKey: string;
  key: string;
  guid: string;
  slug: string;
  studio?: string | undefined;
  type: string;
  title: string;
  titleSort: string;
  contentRating?: string | undefined;
  summary: string;
  rating: number;
  audienceRating: number;
  year?: number | undefined;
  tagline: string;
  thumb: string;
  art: string;
  theme: string;
  index: number;
  leafCount?: number | undefined;
  viewedLeafCount?: number | undefined;
  childCount: number;
  seasonCount: number;
  duration: number;
  originallyAvailableAt: string;
  addedAt: number;
  updatedAt?: number | undefined;
  audienceRatingImage?: string | undefined;
  chapterSource?: string | undefined;
  primaryExtraKey?: string | undefined;
  originalTitle?: string | undefined;
  parentRatingKey?: string | undefined;
  grandparentRatingKey?: string | undefined;
  parentGuid?: string | undefined;
  grandparentGuid?: string | undefined;
  grandparentSlug?: string | undefined;
  grandparentKey?: string | undefined;
  parentKey?: string | undefined;
  grandparentTitle?: string | undefined;
  grandparentThumb?: string | undefined;
  grandparentTheme?: string | undefined;
  grandparentArt?: string | undefined;
  parentTitle?: string | undefined;
  parentIndex?: number | undefined;
  parentThumb?: string | undefined;
  ratingImage?: string | undefined;
  viewCount?: number | undefined;
  viewOffset?: number | undefined;
  skipCount?: number | undefined;
  subtype?: string | undefined;
  lastRatedAt?: number | undefined;
  createdAtAccuracy?: string | undefined;
  createdAtTZOffset?: string | undefined;
  lastViewedAt?: number | undefined;
  userRating?: number | undefined;
  Image?: Array<GetAllMediaLibraryImage$Outbound> | undefined;
  UltraBlurColors?: GetAllMediaLibraryUltraBlurColors$Outbound | undefined;
  Media?: Array<GetAllMediaLibraryMedia$Outbound> | undefined;
  Genre?: Array<GetAllMediaLibraryGenre$Outbound> | undefined;
  Country?: Array<GetAllMediaLibraryCountry$Outbound> | undefined;
  Director?: Array<GetAllMediaLibraryDirector$Outbound> | undefined;
  Writer?: Array<GetAllMediaLibraryWriter$Outbound> | undefined;
  Role?: Array<GetAllMediaLibraryRole$Outbound> | undefined;
  Guid?: Array<GetAllMediaLibraryGuids$Outbound> | undefined;
  Collection?: Array<GetAllMediaLibraryCollection$Outbound> | undefined;
};

/** @internal */
export const GetAllMediaLibraryMetadata$outboundSchema: z.ZodType<
  GetAllMediaLibraryMetadata$Outbound,
  z.ZodTypeDef,
  GetAllMediaLibraryMetadata
> = z.object({
  ratingKey: z.string(),
  key: z.string(),
  guid: z.string(),
  slug: z.string(),
  studio: z.string().optional(),
  type: GetAllMediaLibraryLibraryType$outboundSchema,
  title: z.string(),
  titleSort: z.string(),
  contentRating: z.string().optional(),
  summary: z.string(),
  rating: z.number(),
  audienceRating: z.number(),
  year: z.number().int().optional(),
  tagline: z.string(),
  thumb: z.string(),
  art: z.string(),
  theme: z.string(),
  index: z.number().int(),
  leafCount: z.number().int().optional(),
  viewedLeafCount: z.number().int().optional(),
  childCount: z.number().int(),
  seasonCount: z.number().int(),
  duration: z.number().int(),
  originallyAvailableAt: z.instanceof(RFCDate).transform(v => v.toString()),
  addedAt: z.number().int(),
  updatedAt: z.number().int().optional(),
  audienceRatingImage: z.string().optional(),
  chapterSource: z.string().optional(),
  primaryExtraKey: z.string().optional(),
  originalTitle: z.string().optional(),
  parentRatingKey: z.string().optional(),
  grandparentRatingKey: z.string().optional(),
  parentGuid: z.string().optional(),
  grandparentGuid: z.string().optional(),
  grandparentSlug: z.string().optional(),
  grandparentKey: z.string().optional(),
  parentKey: z.string().optional(),
  grandparentTitle: z.string().optional(),
  grandparentThumb: z.string().optional(),
  grandparentTheme: z.string().optional(),
  grandparentArt: z.string().optional(),
  parentTitle: z.string().optional(),
  parentIndex: z.number().int().optional(),
  parentThumb: z.string().optional(),
  ratingImage: z.string().optional(),
  viewCount: z.number().int().optional(),
  viewOffset: z.number().int().optional(),
  skipCount: z.number().int().optional(),
  subtype: z.string().optional(),
  lastRatedAt: z.number().int().optional(),
  createdAtAccuracy: z.string().optional(),
  createdAtTZOffset: z.string().optional(),
  lastViewedAt: z.number().int().optional(),
  userRating: z.number().optional(),
  image: z.array(z.lazy(() => GetAllMediaLibraryImage$outboundSchema))
    .optional(),
  ultraBlurColors: z.lazy(() =>
    GetAllMediaLibraryUltraBlurColors$outboundSchema
  ).optional(),
  media: z.array(z.lazy(() => GetAllMediaLibraryMedia$outboundSchema))
    .optional(),
  genre: z.array(z.lazy(() => GetAllMediaLibraryGenre$outboundSchema))
    .optional(),
  country: z.array(z.lazy(() => GetAllMediaLibraryCountry$outboundSchema))
    .optional(),
  director: z.array(z.lazy(() => GetAllMediaLibraryDirector$outboundSchema))
    .optional(),
  writer: z.array(z.lazy(() => GetAllMediaLibraryWriter$outboundSchema))
    .optional(),
  role: z.array(z.lazy(() => GetAllMediaLibraryRole$outboundSchema)).optional(),
  guids: z.array(z.lazy(() => GetAllMediaLibraryGuids$outboundSchema))
    .optional(),
  collection: z.array(z.lazy(() => GetAllMediaLibraryCollection$outboundSchema))
    .optional(),
}).transform((v) => {
  return remap$(v, {
    image: "Image",
    ultraBlurColors: "UltraBlurColors",
    media: "Media",
    genre: "Genre",
    country: "Country",
    director: "Director",
    writer: "Writer",
    role: "Role",
    guids: "Guid",
    collection: "Collection",
  });
});

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

export function getAllMediaLibraryMetadataToJSON(
  getAllMediaLibraryMetadata: GetAllMediaLibraryMetadata,
): string {
  return JSON.stringify(
    GetAllMediaLibraryMetadata$outboundSchema.parse(getAllMediaLibraryMetadata),
  );
}

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

/** @internal */
export const GetAllMediaLibraryMediaContainer$inboundSchema: z.ZodType<
  GetAllMediaLibraryMediaContainer,
  z.ZodTypeDef,
  unknown
> = z.object({
  size: z.number().int(),
  totalSize: z.number().int(),
  offset: z.number().int(),
  allowSync: z.boolean(),
  art: z.string(),
  content: z.string(),
  identifier: z.string(),
  librarySectionID: z.number().int(),
  librarySectionTitle: z.string(),
  librarySectionUUID: z.string().optional(),
  mediaTagPrefix: z.string(),
  mediaTagVersion: z.number().int(),
  thumb: z.string(),
  nocache: z.boolean(),
  title1: z.string(),
  title2: z.string(),
  viewGroup: z.string(),
  Meta: z.lazy(() => GetAllMediaLibraryMeta$inboundSchema).optional(),
  Metadata: z.array(z.lazy(() => GetAllMediaLibraryMetadata$inboundSchema))
    .optional(),
}).transform((v) => {
  return remap$(v, {
    "Meta": "meta",
    "Metadata": "metadata",
  });
});

/** @internal */
export type GetAllMediaLibraryMediaContainer$Outbound = {
  size: number;
  totalSize: number;
  offset: number;
  allowSync: boolean;
  art: string;
  content: string;
  identifier: string;
  librarySectionID: number;
  librarySectionTitle: string;
  librarySectionUUID?: string | undefined;
  mediaTagPrefix: string;
  mediaTagVersion: number;
  thumb: string;
  nocache: boolean;
  title1: string;
  title2: string;
  viewGroup: string;
  Meta?: GetAllMediaLibraryMeta$Outbound | undefined;
  Metadata?: Array<GetAllMediaLibraryMetadata$Outbound> | undefined;
};

/** @internal */
export const GetAllMediaLibraryMediaContainer$outboundSchema: z.ZodType<
  GetAllMediaLibraryMediaContainer$Outbound,
  z.ZodTypeDef,
  GetAllMediaLibraryMediaContainer
> = z.object({
  size: z.number().int(),
  totalSize: z.number().int(),
  offset: z.number().int(),
  allowSync: z.boolean(),
  art: z.string(),
  content: z.string(),
  identifier: z.string(),
  librarySectionID: z.number().int(),
  librarySectionTitle: z.string(),
  librarySectionUUID: z.string().optional(),
  mediaTagPrefix: z.string(),
  mediaTagVersion: z.number().int(),
  thumb: z.string(),
  nocache: z.boolean(),
  title1: z.string(),
  title2: z.string(),
  viewGroup: z.string(),
  meta: z.lazy(() => GetAllMediaLibraryMeta$outboundSchema).optional(),
  metadata: z.array(z.lazy(() => GetAllMediaLibraryMetadata$outboundSchema))
    .optional(),
}).transform((v) => {
  return remap$(v, {
    meta: "Meta",
    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 GetAllMediaLibraryMediaContainer$ {
  /** @deprecated use `GetAllMediaLibraryMediaContainer$inboundSchema` instead. */
  export const inboundSchema = GetAllMediaLibraryMediaContainer$inboundSchema;
  /** @deprecated use `GetAllMediaLibraryMediaContainer$outboundSchema` instead. */
  export const outboundSchema = GetAllMediaLibraryMediaContainer$outboundSchema;
  /** @deprecated use `GetAllMediaLibraryMediaContainer$Outbound` instead. */
  export type Outbound = GetAllMediaLibraryMediaContainer$Outbound;
}

export function getAllMediaLibraryMediaContainerToJSON(
  getAllMediaLibraryMediaContainer: GetAllMediaLibraryMediaContainer,
): string {
  return JSON.stringify(
    GetAllMediaLibraryMediaContainer$outboundSchema.parse(
      getAllMediaLibraryMediaContainer,
    ),
  );
}

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

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

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

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

export function getAllMediaLibraryResponseBodyToJSON(
  getAllMediaLibraryResponseBody: GetAllMediaLibraryResponseBody,
): string {
  return JSON.stringify(
    GetAllMediaLibraryResponseBody$outboundSchema.parse(
      getAllMediaLibraryResponseBody,
    ),
  );
}

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

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

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

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

export function getAllMediaLibraryResponseToJSON(
  getAllMediaLibraryResponse: GetAllMediaLibraryResponse,
): string {
  return JSON.stringify(
    GetAllMediaLibraryResponse$outboundSchema.parse(getAllMediaLibraryResponse),
  );
}

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