/*
 * 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";

export enum SearchTypes {
  Movies = "movies",
  Music = "music",
  OtherVideos = "otherVideos",
  People = "people",
  Tv = "tv",
}

/**
 * Whether to include collections in the search results.
 */
export enum QueryParamIncludeCollections {
  Disable = 0,
  Enable = 1,
}

/**
 * Whether to include external media in the search results.
 */
export enum QueryParamIncludeExternalMedia {
  Disable = 0,
  Enable = 1,
}

export type GetSearchAllLibrariesRequest = {
  /**
   * The search query term.
   */
  query: string;
  /**
   * An opaque identifier unique to the client (UUID, serial number, or other unique device ID)
   */
  clientID: string;
  /**
   * Limit the number of results returned.
   */
  limit?: number | undefined;
  /**
   * A comma-separated list of search types to include. Valid values are: movies, music, otherVideos, people, tv.
   *
   * @remarks
   */
  searchTypes?: Array<SearchTypes> | undefined;
  /**
   * Whether to include collections in the search results.
   */
  includeCollections?: QueryParamIncludeCollections | undefined;
  /**
   * Whether to include external media in the search results.
   */
  includeExternalMedia?: QueryParamIncludeExternalMedia | undefined;
};

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

/**
 * Setting that indicates if seasons are set to hidden for the show. (-1 = Library default, 0 = Hide, 1 = Show).
 */
export enum GetSearchAllLibrariesFlattenSeasons {
  LibraryDefault = "-1",
  Hide = "0",
  Show = "1",
}

/**
 * Setting that indicates how episodes are sorted for the show. (-1 = Library default, 0 = Oldest first, 1 = Newest first).
 */
export enum GetSearchAllLibrariesEpisodeSort {
  LibraryDefault = "-1",
  OldestFirst = "0",
  NewestFirst = "1",
}

/**
 * Setting that indicates if credits markers detection is enabled. (-1 = Library default, 0 = Disabled).
 */
export enum GetSearchAllLibrariesEnableCreditsMarkerGeneration {
  LibraryDefault = "-1",
  Disabled = "0",
}

/**
 * Setting that indicates the episode ordering for the show.
 *
 * @remarks
 * None = Library default,
 * tmdbAiring = The Movie Database (Aired),
 * aired = TheTVDB (Aired),
 * dvd = TheTVDB (DVD),
 * absolute = TheTVDB (Absolute)).
 */
export enum GetSearchAllLibrariesShowOrdering {
  None = "None",
  TmdbAiring = "tmdbAiring",
  TvdbAired = "aired",
  TvdbDvd = "dvd",
  TvdbAbsolute = "absolute",
}

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

export enum GetSearchAllLibrariesHasThumbnail {
  False = "0",
  True = "1",
}

export type GetSearchAllLibrariesStream = {
  id: number;
  /**
   * Type of stream (1 = video, 2 = audio, 3 = subtitle)
   */
  streamType: number;
  /**
   * Indicates if this is the default stream
   */
  default?: boolean | undefined;
  /**
   * Indicates if the stream is selected
   */
  selected?: boolean | undefined;
  /**
   * Codec used by the stream
   */
  codec: string;
  /**
   * The index of the stream
   */
  index: number;
  /**
   * The bitrate of the stream in kbps
   */
  bitrate?: number | undefined;
  /**
   * The color primaries of the video stream
   */
  colorPrimaries?: string | undefined;
  /**
   * The color range of the video stream
   */
  colorRange?: string | undefined;
  /**
   * The color space of the video stream
   */
  colorSpace?: string | undefined;
  /**
   * The transfer characteristics (TRC) of the video stream
   */
  colorTrc?: string | undefined;
  /**
   * The bit depth of the video stream
   */
  bitDepth?: number | undefined;
  /**
   * The chroma location of the video stream
   */
  chromaLocation?: string | undefined;
  /**
   * The identifier of the video stream
   */
  streamIdentifier?: string | undefined;
  /**
   * The chroma subsampling format
   */
  chromaSubsampling?: string | undefined;
  /**
   * The coded height of the video stream
   */
  codedHeight?: number | undefined;
  /**
   * The coded width of the video stream
   */
  codedWidth?: number | undefined;
  /**
   * The frame rate of the video stream
   */
  frameRate?: number | undefined;
  /**
   * Indicates if the stream has a scaling matrix
   */
  hasScalingMatrix?: boolean | undefined;
  hearingImpaired?: boolean | undefined;
  closedCaptions?: boolean | undefined;
  embeddedInVideo?: string | undefined;
  /**
   * The height of the video stream
   */
  height?: number | undefined;
  /**
   * The level of the video codec
   */
  level?: number | undefined;
  /**
   * The profile of the video codec
   */
  profile?: string | undefined;
  /**
   * Number of reference frames
   */
  refFrames?: number | undefined;
  /**
   * The scan type (progressive or interlaced)
   */
  scanType?: string | undefined;
  /**
   * The width of the video stream
   */
  width?: number | undefined;
  /**
   * Display title of the stream
   */
  displayTitle?: string | undefined;
  /**
   * Extended display title of the stream
   */
  extendedDisplayTitle?: string | undefined;
  /**
   * Number of audio channels (for audio streams)
   */
  channels?: number | undefined;
  /**
   * The language of the stream (for audio/subtitle streams)
   */
  language?: string | undefined;
  /**
   * Language tag of the stream
   */
  languageTag?: string | undefined;
  /**
   * Language code of the stream
   */
  languageCode?: string | undefined;
  /**
   * The audio channel layout
   */
  audioChannelLayout?: string | undefined;
  /**
   * Sampling rate of the audio stream in Hz
   */
  samplingRate?: number | undefined;
  /**
   * Title of the subtitle track (for subtitle streams)
   */
  title?: string | undefined;
  /**
   * Indicates if the subtitle stream can auto-sync
   */
  canAutoSync?: boolean | undefined;
};

export type GetSearchAllLibrariesPart = {
  id: number;
  key: string;
  duration?: number | undefined;
  file: string;
  size: number;
  /**
   * The container format of the media file.
   *
   * @remarks
   */
  container: string;
  audioProfile?: string | undefined;
  has64bitOffsets?: boolean | undefined;
  optimizedForStreaming?: boolean | undefined;
  videoProfile?: string | undefined;
  indexes?: string | undefined;
  hasThumbnail?: GetSearchAllLibrariesHasThumbnail | undefined;
  stream?: Array<GetSearchAllLibrariesStream> | undefined;
};

export type GetSearchAllLibrariesMedia = {
  id: number;
  duration?: number | undefined;
  bitrate?: number | undefined;
  width?: number | undefined;
  height?: number | undefined;
  aspectRatio?: number | undefined;
  audioProfile?: string | undefined;
  audioChannels?: number | undefined;
  audioCodec?: string | undefined;
  videoCodec?: string | undefined;
  videoResolution?: string | undefined;
  container: string;
  videoFrameRate?: string | undefined;
  videoProfile?: string | undefined;
  hasVoiceActivity?: boolean | undefined;
  optimizedForStreaming?:
    | GetSearchAllLibrariesOptimizedForStreaming
    | undefined;
  has64bitOffsets?: boolean | undefined;
  part: Array<GetSearchAllLibrariesPart>;
};

export type GetSearchAllLibrariesGenre = {
  tag?: string | undefined;
};

export type GetSearchAllLibrariesCountry = {
  tag?: string | undefined;
};

export type GetSearchAllLibrariesDirector = {
  tag?: string | undefined;
};

export type GetSearchAllLibrariesWriter = {
  tag?: string | undefined;
};

export type GetSearchAllLibrariesCollection = {
  tag?: string | undefined;
};

export type GetSearchAllLibrariesRole = {
  /**
   * The ID of the tag or actor.
   */
  id?: number | undefined;
  /**
   * The filter used to find the actor or tag.
   */
  filter?: string | undefined;
  /**
   * The thumbnail of the actor
   */
  thumb?: string | undefined;
  /**
   * The name of the tag or actor.
   */
  tag?: string | undefined;
  /**
   * Unique identifier for the tag.
   */
  tagKey?: string | undefined;
  /**
   * The role of the actor or tag in the media.
   */
  role?: string | undefined;
};

export type GetSearchAllLibrariesLocation = {
  path?: string | undefined;
};

export type GetSearchAllLibrariesMediaGuid = {
  /**
   * Can be one of the following formats:
   *
   * @remarks
   * imdb://tt13015952, tmdb://2434012, tvdb://7945991
   */
  id: string;
};

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

export type GetSearchAllLibrariesMetaDataRating = {
  /**
   * A URI or path to the rating image.
   */
  image: string;
  /**
   * The value of the rating.
   */
  value: number;
  /**
   * The type of rating (e.g., audience, critic).
   */
  type: string;
};

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

export type GetSearchAllLibrariesImage = {
  alt: string;
  type: GetSearchAllLibrariesLibraryType;
  url: string;
};

export type GetSearchAllLibrariesMetadata = {
  /**
   * The rating key (Media ID) of this media item.
   *
   * @remarks
   * Note: This is always an integer, but is represented as a string in the API.
   */
  ratingKey: string;
  key: string;
  guid: string;
  studio?: string | undefined;
  skipChildren?: boolean | undefined;
  librarySectionID?: number | undefined;
  librarySectionTitle?: string | undefined;
  librarySectionKey?: string | undefined;
  /**
   * The type of media content
   *
   * @remarks
   */
  type: GetSearchAllLibrariesType;
  title: string;
  slug?: string | undefined;
  contentRating?: string | undefined;
  summary: string;
  rating?: number | undefined;
  audienceRating?: number | undefined;
  year?: number | undefined;
  seasonCount?: number | undefined;
  tagline?: string | undefined;
  /**
   * Setting that indicates if seasons are set to hidden for the show. (-1 = Library default, 0 = Hide, 1 = Show).
   */
  flattenSeasons?: GetSearchAllLibrariesFlattenSeasons | undefined;
  /**
   * Setting that indicates how episodes are sorted for the show. (-1 = Library default, 0 = Oldest first, 1 = Newest first).
   */
  episodeSort?: GetSearchAllLibrariesEpisodeSort | undefined;
  /**
   * Setting that indicates if credits markers detection is enabled. (-1 = Library default, 0 = Disabled).
   */
  enableCreditsMarkerGeneration?:
    | GetSearchAllLibrariesEnableCreditsMarkerGeneration
    | undefined;
  /**
   * Setting that indicates the episode ordering for the show.
   *
   * @remarks
   * None = Library default,
   * tmdbAiring = The Movie Database (Aired),
   * aired = TheTVDB (Aired),
   * dvd = TheTVDB (DVD),
   * absolute = TheTVDB (Absolute)).
   */
  showOrdering?: GetSearchAllLibrariesShowOrdering | undefined;
  thumb?: string | undefined;
  art?: string | undefined;
  banner?: string | undefined;
  duration?: number | undefined;
  originallyAvailableAt?: RFCDate | undefined;
  /**
   * Unix epoch datetime in seconds
   */
  addedAt: number;
  /**
   * Unix epoch datetime in seconds
   */
  updatedAt?: number | undefined;
  audienceRatingImage?: string | undefined;
  chapterSource?: string | undefined;
  primaryExtraKey?: string | undefined;
  ratingImage?: string | undefined;
  grandparentRatingKey?: string | undefined;
  grandparentGuid?: string | undefined;
  grandparentKey?: string | undefined;
  grandparentTitle?: string | undefined;
  grandparentThumb?: string | undefined;
  parentSlug?: string | undefined;
  grandparentSlug?: string | undefined;
  grandparentArt?: string | undefined;
  grandparentTheme?: string | undefined;
  /**
   * The Media object is only included when type query is `4` or higher.
   *
   * @remarks
   */
  media?: Array<GetSearchAllLibrariesMedia> | undefined;
  genre?: Array<GetSearchAllLibrariesGenre> | undefined;
  country?: Array<GetSearchAllLibrariesCountry> | undefined;
  director?: Array<GetSearchAllLibrariesDirector> | undefined;
  writer?: Array<GetSearchAllLibrariesWriter> | undefined;
  collection?: Array<GetSearchAllLibrariesCollection> | undefined;
  role?: Array<GetSearchAllLibrariesRole> | undefined;
  location?: Array<GetSearchAllLibrariesLocation> | undefined;
  /**
   * The Guid object is only included in the response if the `includeGuids` parameter is set to `1`.
   *
   * @remarks
   */
  mediaGuid?: Array<GetSearchAllLibrariesMediaGuid> | undefined;
  ultraBlurColors?: GetSearchAllLibrariesUltraBlurColors | undefined;
  metaDataRating?: Array<GetSearchAllLibrariesMetaDataRating> | undefined;
  image?: Array<GetSearchAllLibrariesImage> | undefined;
  titleSort?: string | undefined;
  viewCount?: number | undefined;
  lastViewedAt?: number | undefined;
  originalTitle?: string | undefined;
  viewOffset?: number | undefined;
  skipCount?: number | undefined;
  index?: number | undefined;
  theme?: string | undefined;
  leafCount?: number | undefined;
  viewedLeafCount?: number | undefined;
  childCount?: number | undefined;
  hasPremiumExtras?: string | undefined;
  hasPremiumPrimaryExtra?: string | undefined;
  /**
   * The rating key of the parent item.
   *
   * @remarks
   */
  parentRatingKey?: string | undefined;
  parentGuid?: string | undefined;
  parentStudio?: string | undefined;
  parentKey?: string | undefined;
  parentTitle?: string | undefined;
  parentIndex?: number | undefined;
  parentYear?: number | undefined;
  parentThumb?: string | undefined;
  parentTheme?: string | undefined;
};

export type SearchResult = {
  score: number;
  metadata: GetSearchAllLibrariesMetadata;
};

export type GetSearchAllLibrariesMediaContainer = {
  size: number;
  searchResult: Array<SearchResult>;
};

/**
 * The libraries available on the Server
 */
export type GetSearchAllLibrariesResponseBody = {
  mediaContainer: GetSearchAllLibrariesMediaContainer;
};

export type GetSearchAllLibrariesResponse = {
  /**
   * HTTP response content type for this operation
   */
  contentType: string;
  /**
   * HTTP response status code for this operation
   */
  statusCode: number;
  /**
   * Raw HTTP response; suitable for custom response parsing
   */
  rawResponse: Response;
  /**
   * The libraries available on the Server
   */
  object?: GetSearchAllLibrariesResponseBody | undefined;
};

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

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

/**
 * @internal
 * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
 */
export namespace SearchTypes$ {
  /** @deprecated use `SearchTypes$inboundSchema` instead. */
  export const inboundSchema = SearchTypes$inboundSchema;
  /** @deprecated use `SearchTypes$outboundSchema` instead. */
  export const outboundSchema = SearchTypes$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 GetSearchAllLibrariesRequest$inboundSchema: z.ZodType<
  GetSearchAllLibrariesRequest,
  z.ZodTypeDef,
  unknown
> = z.object({
  query: z.string(),
  ClientID: z.string(),
  limit: z.number().int().optional(),
  searchTypes: z.array(SearchTypes$inboundSchema).optional(),
  includeCollections: QueryParamIncludeCollections$inboundSchema,
  includeExternalMedia: QueryParamIncludeExternalMedia$inboundSchema,
}).transform((v) => {
  return remap$(v, {
    "ClientID": "clientID",
  });
});

/** @internal */
export type GetSearchAllLibrariesRequest$Outbound = {
  query: string;
  ClientID: string;
  limit?: number | undefined;
  searchTypes?: Array<string> | undefined;
  includeCollections: number;
  includeExternalMedia: number;
};

/** @internal */
export const GetSearchAllLibrariesRequest$outboundSchema: z.ZodType<
  GetSearchAllLibrariesRequest$Outbound,
  z.ZodTypeDef,
  GetSearchAllLibrariesRequest
> = z.object({
  query: z.string(),
  clientID: z.string(),
  limit: z.number().int().optional(),
  searchTypes: z.array(SearchTypes$outboundSchema).optional(),
  includeCollections: QueryParamIncludeCollections$outboundSchema.default(
    QueryParamIncludeCollections.Disable,
  ),
  includeExternalMedia: QueryParamIncludeExternalMedia$outboundSchema.default(
    QueryParamIncludeExternalMedia.Disable,
  ),
}).transform((v) => {
  return remap$(v, {
    clientID: "ClientID",
  });
});

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

export function getSearchAllLibrariesRequestToJSON(
  getSearchAllLibrariesRequest: GetSearchAllLibrariesRequest,
): string {
  return JSON.stringify(
    GetSearchAllLibrariesRequest$outboundSchema.parse(
      getSearchAllLibrariesRequest,
    ),
  );
}

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

/** @internal */
export const GetSearchAllLibrariesStream$inboundSchema: z.ZodType<
  GetSearchAllLibrariesStream,
  z.ZodTypeDef,
  unknown
> = z.object({
  id: z.number().int(),
  streamType: z.number().int(),
  default: z.boolean().optional(),
  selected: z.boolean().optional(),
  codec: z.string(),
  index: z.number().int(),
  bitrate: z.number().int().optional(),
  colorPrimaries: z.string().optional(),
  colorRange: z.string().optional(),
  colorSpace: z.string().optional(),
  colorTrc: z.string().optional(),
  bitDepth: z.number().int().optional(),
  chromaLocation: z.string().optional(),
  streamIdentifier: z.string().optional(),
  chromaSubsampling: z.string().optional(),
  codedHeight: z.number().int().optional(),
  codedWidth: z.number().int().optional(),
  frameRate: z.number().optional(),
  hasScalingMatrix: z.boolean().optional(),
  hearingImpaired: z.boolean().optional(),
  closedCaptions: z.boolean().optional(),
  embeddedInVideo: z.string().optional(),
  height: z.number().int().optional(),
  level: z.number().int().optional(),
  profile: z.string().optional(),
  refFrames: z.number().int().optional(),
  scanType: z.string().optional(),
  width: z.number().int().optional(),
  displayTitle: z.string().optional(),
  extendedDisplayTitle: z.string().optional(),
  channels: z.number().int().optional(),
  language: z.string().optional(),
  languageTag: z.string().optional(),
  languageCode: z.string().optional(),
  audioChannelLayout: z.string().optional(),
  samplingRate: z.number().int().optional(),
  title: z.string().optional(),
  canAutoSync: z.boolean().optional(),
});

/** @internal */
export type GetSearchAllLibrariesStream$Outbound = {
  id: number;
  streamType: number;
  default?: boolean | undefined;
  selected?: boolean | undefined;
  codec: string;
  index: number;
  bitrate?: number | undefined;
  colorPrimaries?: string | undefined;
  colorRange?: string | undefined;
  colorSpace?: string | undefined;
  colorTrc?: string | undefined;
  bitDepth?: number | undefined;
  chromaLocation?: string | undefined;
  streamIdentifier?: string | undefined;
  chromaSubsampling?: string | undefined;
  codedHeight?: number | undefined;
  codedWidth?: number | undefined;
  frameRate?: number | undefined;
  hasScalingMatrix?: boolean | undefined;
  hearingImpaired?: boolean | undefined;
  closedCaptions?: boolean | undefined;
  embeddedInVideo?: string | undefined;
  height?: number | undefined;
  level?: number | undefined;
  profile?: string | undefined;
  refFrames?: number | undefined;
  scanType?: string | undefined;
  width?: number | undefined;
  displayTitle?: string | undefined;
  extendedDisplayTitle?: string | undefined;
  channels?: number | undefined;
  language?: string | undefined;
  languageTag?: string | undefined;
  languageCode?: string | undefined;
  audioChannelLayout?: string | undefined;
  samplingRate?: number | undefined;
  title?: string | undefined;
  canAutoSync?: boolean | undefined;
};

/** @internal */
export const GetSearchAllLibrariesStream$outboundSchema: z.ZodType<
  GetSearchAllLibrariesStream$Outbound,
  z.ZodTypeDef,
  GetSearchAllLibrariesStream
> = z.object({
  id: z.number().int(),
  streamType: z.number().int(),
  default: z.boolean().optional(),
  selected: z.boolean().optional(),
  codec: z.string(),
  index: z.number().int(),
  bitrate: z.number().int().optional(),
  colorPrimaries: z.string().optional(),
  colorRange: z.string().optional(),
  colorSpace: z.string().optional(),
  colorTrc: z.string().optional(),
  bitDepth: z.number().int().optional(),
  chromaLocation: z.string().optional(),
  streamIdentifier: z.string().optional(),
  chromaSubsampling: z.string().optional(),
  codedHeight: z.number().int().optional(),
  codedWidth: z.number().int().optional(),
  frameRate: z.number().optional(),
  hasScalingMatrix: z.boolean().optional(),
  hearingImpaired: z.boolean().optional(),
  closedCaptions: z.boolean().optional(),
  embeddedInVideo: z.string().optional(),
  height: z.number().int().optional(),
  level: z.number().int().optional(),
  profile: z.string().optional(),
  refFrames: z.number().int().optional(),
  scanType: z.string().optional(),
  width: z.number().int().optional(),
  displayTitle: z.string().optional(),
  extendedDisplayTitle: z.string().optional(),
  channels: z.number().int().optional(),
  language: z.string().optional(),
  languageTag: z.string().optional(),
  languageCode: z.string().optional(),
  audioChannelLayout: z.string().optional(),
  samplingRate: z.number().int().optional(),
  title: z.string().optional(),
  canAutoSync: 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 GetSearchAllLibrariesStream$ {
  /** @deprecated use `GetSearchAllLibrariesStream$inboundSchema` instead. */
  export const inboundSchema = GetSearchAllLibrariesStream$inboundSchema;
  /** @deprecated use `GetSearchAllLibrariesStream$outboundSchema` instead. */
  export const outboundSchema = GetSearchAllLibrariesStream$outboundSchema;
  /** @deprecated use `GetSearchAllLibrariesStream$Outbound` instead. */
  export type Outbound = GetSearchAllLibrariesStream$Outbound;
}

export function getSearchAllLibrariesStreamToJSON(
  getSearchAllLibrariesStream: GetSearchAllLibrariesStream,
): string {
  return JSON.stringify(
    GetSearchAllLibrariesStream$outboundSchema.parse(
      getSearchAllLibrariesStream,
    ),
  );
}

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

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

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

/** @internal */
export const GetSearchAllLibrariesPart$outboundSchema: z.ZodType<
  GetSearchAllLibrariesPart$Outbound,
  z.ZodTypeDef,
  GetSearchAllLibrariesPart
> = z.object({
  id: z.number().int(),
  key: z.string(),
  duration: z.number().int().optional(),
  file: z.string(),
  size: z.number().int(),
  container: z.string(),
  audioProfile: z.string().optional(),
  has64bitOffsets: z.boolean().optional(),
  optimizedForStreaming: z.boolean().optional(),
  videoProfile: z.string().optional(),
  indexes: z.string().optional(),
  hasThumbnail: GetSearchAllLibrariesHasThumbnail$outboundSchema.default(
    GetSearchAllLibrariesHasThumbnail.False,
  ),
  stream: z.array(z.lazy(() => GetSearchAllLibrariesStream$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 GetSearchAllLibrariesPart$ {
  /** @deprecated use `GetSearchAllLibrariesPart$inboundSchema` instead. */
  export const inboundSchema = GetSearchAllLibrariesPart$inboundSchema;
  /** @deprecated use `GetSearchAllLibrariesPart$outboundSchema` instead. */
  export const outboundSchema = GetSearchAllLibrariesPart$outboundSchema;
  /** @deprecated use `GetSearchAllLibrariesPart$Outbound` instead. */
  export type Outbound = GetSearchAllLibrariesPart$Outbound;
}

export function getSearchAllLibrariesPartToJSON(
  getSearchAllLibrariesPart: GetSearchAllLibrariesPart,
): string {
  return JSON.stringify(
    GetSearchAllLibrariesPart$outboundSchema.parse(getSearchAllLibrariesPart),
  );
}

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

/** @internal */
export const GetSearchAllLibrariesMedia$inboundSchema: z.ZodType<
  GetSearchAllLibrariesMedia,
  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(),
  audioProfile: z.string().optional(),
  audioChannels: z.number().int().optional(),
  audioCodec: z.string().optional(),
  videoCodec: z.string().optional(),
  videoResolution: z.string().optional(),
  container: z.string(),
  videoFrameRate: z.string().optional(),
  videoProfile: z.string().optional(),
  hasVoiceActivity: z.boolean().optional(),
  optimizedForStreaming:
    GetSearchAllLibrariesOptimizedForStreaming$inboundSchema,
  has64bitOffsets: z.boolean().optional(),
  Part: z.array(z.lazy(() => GetSearchAllLibrariesPart$inboundSchema)),
}).transform((v) => {
  return remap$(v, {
    "Part": "part",
  });
});

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

/** @internal */
export const GetSearchAllLibrariesMedia$outboundSchema: z.ZodType<
  GetSearchAllLibrariesMedia$Outbound,
  z.ZodTypeDef,
  GetSearchAllLibrariesMedia
> = 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(),
  audioProfile: z.string().optional(),
  audioChannels: z.number().int().optional(),
  audioCodec: z.string().optional(),
  videoCodec: z.string().optional(),
  videoResolution: z.string().optional(),
  container: z.string(),
  videoFrameRate: z.string().optional(),
  videoProfile: z.string().optional(),
  hasVoiceActivity: z.boolean().optional(),
  optimizedForStreaming:
    GetSearchAllLibrariesOptimizedForStreaming$outboundSchema.default(
      GetSearchAllLibrariesOptimizedForStreaming.Disable,
    ),
  has64bitOffsets: z.boolean().optional(),
  part: z.array(z.lazy(() => GetSearchAllLibrariesPart$outboundSchema)),
}).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 GetSearchAllLibrariesMedia$ {
  /** @deprecated use `GetSearchAllLibrariesMedia$inboundSchema` instead. */
  export const inboundSchema = GetSearchAllLibrariesMedia$inboundSchema;
  /** @deprecated use `GetSearchAllLibrariesMedia$outboundSchema` instead. */
  export const outboundSchema = GetSearchAllLibrariesMedia$outboundSchema;
  /** @deprecated use `GetSearchAllLibrariesMedia$Outbound` instead. */
  export type Outbound = GetSearchAllLibrariesMedia$Outbound;
}

export function getSearchAllLibrariesMediaToJSON(
  getSearchAllLibrariesMedia: GetSearchAllLibrariesMedia,
): string {
  return JSON.stringify(
    GetSearchAllLibrariesMedia$outboundSchema.parse(getSearchAllLibrariesMedia),
  );
}

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

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

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

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

export function getSearchAllLibrariesGenreToJSON(
  getSearchAllLibrariesGenre: GetSearchAllLibrariesGenre,
): string {
  return JSON.stringify(
    GetSearchAllLibrariesGenre$outboundSchema.parse(getSearchAllLibrariesGenre),
  );
}

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

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

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

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

export function getSearchAllLibrariesCountryToJSON(
  getSearchAllLibrariesCountry: GetSearchAllLibrariesCountry,
): string {
  return JSON.stringify(
    GetSearchAllLibrariesCountry$outboundSchema.parse(
      getSearchAllLibrariesCountry,
    ),
  );
}

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

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

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

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

export function getSearchAllLibrariesDirectorToJSON(
  getSearchAllLibrariesDirector: GetSearchAllLibrariesDirector,
): string {
  return JSON.stringify(
    GetSearchAllLibrariesDirector$outboundSchema.parse(
      getSearchAllLibrariesDirector,
    ),
  );
}

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

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

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

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

export function getSearchAllLibrariesWriterToJSON(
  getSearchAllLibrariesWriter: GetSearchAllLibrariesWriter,
): string {
  return JSON.stringify(
    GetSearchAllLibrariesWriter$outboundSchema.parse(
      getSearchAllLibrariesWriter,
    ),
  );
}

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

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

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

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

export function getSearchAllLibrariesCollectionToJSON(
  getSearchAllLibrariesCollection: GetSearchAllLibrariesCollection,
): string {
  return JSON.stringify(
    GetSearchAllLibrariesCollection$outboundSchema.parse(
      getSearchAllLibrariesCollection,
    ),
  );
}

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

/** @internal */
export const GetSearchAllLibrariesRole$inboundSchema: z.ZodType<
  GetSearchAllLibrariesRole,
  z.ZodTypeDef,
  unknown
> = z.object({
  id: z.number().int().optional(),
  filter: z.string().optional(),
  thumb: z.string().optional(),
  tag: z.string().optional(),
  tagKey: z.string().optional(),
  role: z.string().optional(),
});

/** @internal */
export type GetSearchAllLibrariesRole$Outbound = {
  id?: number | undefined;
  filter?: string | undefined;
  thumb?: string | undefined;
  tag?: string | undefined;
  tagKey?: string | undefined;
  role?: string | undefined;
};

/** @internal */
export const GetSearchAllLibrariesRole$outboundSchema: z.ZodType<
  GetSearchAllLibrariesRole$Outbound,
  z.ZodTypeDef,
  GetSearchAllLibrariesRole
> = z.object({
  id: z.number().int().optional(),
  filter: z.string().optional(),
  thumb: z.string().optional(),
  tag: z.string().optional(),
  tagKey: z.string().optional(),
  role: 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 GetSearchAllLibrariesRole$ {
  /** @deprecated use `GetSearchAllLibrariesRole$inboundSchema` instead. */
  export const inboundSchema = GetSearchAllLibrariesRole$inboundSchema;
  /** @deprecated use `GetSearchAllLibrariesRole$outboundSchema` instead. */
  export const outboundSchema = GetSearchAllLibrariesRole$outboundSchema;
  /** @deprecated use `GetSearchAllLibrariesRole$Outbound` instead. */
  export type Outbound = GetSearchAllLibrariesRole$Outbound;
}

export function getSearchAllLibrariesRoleToJSON(
  getSearchAllLibrariesRole: GetSearchAllLibrariesRole,
): string {
  return JSON.stringify(
    GetSearchAllLibrariesRole$outboundSchema.parse(getSearchAllLibrariesRole),
  );
}

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

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

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

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

export function getSearchAllLibrariesLocationToJSON(
  getSearchAllLibrariesLocation: GetSearchAllLibrariesLocation,
): string {
  return JSON.stringify(
    GetSearchAllLibrariesLocation$outboundSchema.parse(
      getSearchAllLibrariesLocation,
    ),
  );
}

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

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

/** @internal */
export type GetSearchAllLibrariesMediaGuid$Outbound = {
  id: string;
};

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

export function getSearchAllLibrariesMediaGuidToJSON(
  getSearchAllLibrariesMediaGuid: GetSearchAllLibrariesMediaGuid,
): string {
  return JSON.stringify(
    GetSearchAllLibrariesMediaGuid$outboundSchema.parse(
      getSearchAllLibrariesMediaGuid,
    ),
  );
}

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

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

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

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

export function getSearchAllLibrariesUltraBlurColorsToJSON(
  getSearchAllLibrariesUltraBlurColors: GetSearchAllLibrariesUltraBlurColors,
): string {
  return JSON.stringify(
    GetSearchAllLibrariesUltraBlurColors$outboundSchema.parse(
      getSearchAllLibrariesUltraBlurColors,
    ),
  );
}

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

/** @internal */
export const GetSearchAllLibrariesMetaDataRating$inboundSchema: z.ZodType<
  GetSearchAllLibrariesMetaDataRating,
  z.ZodTypeDef,
  unknown
> = z.object({
  image: z.string(),
  value: z.number(),
  type: z.string(),
});

/** @internal */
export type GetSearchAllLibrariesMetaDataRating$Outbound = {
  image: string;
  value: number;
  type: string;
};

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

export function getSearchAllLibrariesMetaDataRatingToJSON(
  getSearchAllLibrariesMetaDataRating: GetSearchAllLibrariesMetaDataRating,
): string {
  return JSON.stringify(
    GetSearchAllLibrariesMetaDataRating$outboundSchema.parse(
      getSearchAllLibrariesMetaDataRating,
    ),
  );
}

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

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

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

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

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

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

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

export function getSearchAllLibrariesImageToJSON(
  getSearchAllLibrariesImage: GetSearchAllLibrariesImage,
): string {
  return JSON.stringify(
    GetSearchAllLibrariesImage$outboundSchema.parse(getSearchAllLibrariesImage),
  );
}

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

/** @internal */
export const GetSearchAllLibrariesMetadata$inboundSchema: z.ZodType<
  GetSearchAllLibrariesMetadata,
  z.ZodTypeDef,
  unknown
> = z.object({
  ratingKey: z.string(),
  key: z.string(),
  guid: z.string(),
  studio: z.string().optional(),
  skipChildren: z.boolean().optional(),
  librarySectionID: z.number().int().optional(),
  librarySectionTitle: z.string().optional(),
  librarySectionKey: z.string().optional(),
  type: GetSearchAllLibrariesType$inboundSchema,
  title: z.string(),
  slug: z.string().optional(),
  contentRating: z.string().optional(),
  summary: z.string(),
  rating: z.number().optional(),
  audienceRating: z.number().optional(),
  year: z.number().int().optional(),
  seasonCount: z.number().int().optional(),
  tagline: z.string().optional(),
  flattenSeasons: GetSearchAllLibrariesFlattenSeasons$inboundSchema.optional(),
  episodeSort: GetSearchAllLibrariesEpisodeSort$inboundSchema.optional(),
  enableCreditsMarkerGeneration:
    GetSearchAllLibrariesEnableCreditsMarkerGeneration$inboundSchema.optional(),
  showOrdering: GetSearchAllLibrariesShowOrdering$inboundSchema.optional(),
  thumb: z.string().optional(),
  art: z.string().optional(),
  banner: z.string().optional(),
  duration: z.number().int().optional(),
  originallyAvailableAt: z.string().transform(v => new RFCDate(v)).optional(),
  addedAt: z.number().int(),
  updatedAt: z.number().int().optional(),
  audienceRatingImage: z.string().optional(),
  chapterSource: z.string().optional(),
  primaryExtraKey: z.string().optional(),
  ratingImage: z.string().optional(),
  grandparentRatingKey: z.string().optional(),
  grandparentGuid: z.string().optional(),
  grandparentKey: z.string().optional(),
  grandparentTitle: z.string().optional(),
  grandparentThumb: z.string().optional(),
  parentSlug: z.string().optional(),
  grandparentSlug: z.string().optional(),
  grandparentArt: z.string().optional(),
  grandparentTheme: z.string().optional(),
  Media: z.array(z.lazy(() => GetSearchAllLibrariesMedia$inboundSchema))
    .optional(),
  Genre: z.array(z.lazy(() => GetSearchAllLibrariesGenre$inboundSchema))
    .optional(),
  Country: z.array(z.lazy(() => GetSearchAllLibrariesCountry$inboundSchema))
    .optional(),
  Director: z.array(z.lazy(() => GetSearchAllLibrariesDirector$inboundSchema))
    .optional(),
  Writer: z.array(z.lazy(() => GetSearchAllLibrariesWriter$inboundSchema))
    .optional(),
  Collection: z.array(
    z.lazy(() => GetSearchAllLibrariesCollection$inboundSchema),
  ).optional(),
  Role: z.array(z.lazy(() => GetSearchAllLibrariesRole$inboundSchema))
    .optional(),
  Location: z.array(z.lazy(() => GetSearchAllLibrariesLocation$inboundSchema))
    .optional(),
  Guid: z.array(z.lazy(() => GetSearchAllLibrariesMediaGuid$inboundSchema))
    .optional(),
  UltraBlurColors: z.lazy(() =>
    GetSearchAllLibrariesUltraBlurColors$inboundSchema
  ).optional(),
  Rating: z.array(
    z.lazy(() => GetSearchAllLibrariesMetaDataRating$inboundSchema),
  ).optional(),
  Image: z.array(z.lazy(() => GetSearchAllLibrariesImage$inboundSchema))
    .optional(),
  titleSort: z.string().optional(),
  viewCount: z.number().int().optional(),
  lastViewedAt: z.number().int().optional(),
  originalTitle: z.string().optional(),
  viewOffset: z.number().int().optional(),
  skipCount: z.number().int().optional(),
  index: z.number().int().optional(),
  theme: z.string().optional(),
  leafCount: z.number().int().optional(),
  viewedLeafCount: z.number().int().optional(),
  childCount: z.number().int().optional(),
  hasPremiumExtras: z.string().optional(),
  hasPremiumPrimaryExtra: z.string().optional(),
  parentRatingKey: z.string().optional(),
  parentGuid: z.string().optional(),
  parentStudio: z.string().optional(),
  parentKey: z.string().optional(),
  parentTitle: z.string().optional(),
  parentIndex: z.number().int().optional(),
  parentYear: z.number().int().optional(),
  parentThumb: z.string().optional(),
  parentTheme: z.string().optional(),
}).transform((v) => {
  return remap$(v, {
    "Media": "media",
    "Genre": "genre",
    "Country": "country",
    "Director": "director",
    "Writer": "writer",
    "Collection": "collection",
    "Role": "role",
    "Location": "location",
    "Guid": "mediaGuid",
    "UltraBlurColors": "ultraBlurColors",
    "Rating": "metaDataRating",
    "Image": "image",
  });
});

/** @internal */
export type GetSearchAllLibrariesMetadata$Outbound = {
  ratingKey: string;
  key: string;
  guid: string;
  studio?: string | undefined;
  skipChildren?: boolean | undefined;
  librarySectionID?: number | undefined;
  librarySectionTitle?: string | undefined;
  librarySectionKey?: string | undefined;
  type: string;
  title: string;
  slug?: string | undefined;
  contentRating?: string | undefined;
  summary: string;
  rating?: number | undefined;
  audienceRating?: number | undefined;
  year?: number | undefined;
  seasonCount?: number | undefined;
  tagline?: string | undefined;
  flattenSeasons?: string | undefined;
  episodeSort?: string | undefined;
  enableCreditsMarkerGeneration?: string | undefined;
  showOrdering?: string | undefined;
  thumb?: string | undefined;
  art?: string | undefined;
  banner?: string | undefined;
  duration?: number | undefined;
  originallyAvailableAt?: string | undefined;
  addedAt: number;
  updatedAt?: number | undefined;
  audienceRatingImage?: string | undefined;
  chapterSource?: string | undefined;
  primaryExtraKey?: string | undefined;
  ratingImage?: string | undefined;
  grandparentRatingKey?: string | undefined;
  grandparentGuid?: string | undefined;
  grandparentKey?: string | undefined;
  grandparentTitle?: string | undefined;
  grandparentThumb?: string | undefined;
  parentSlug?: string | undefined;
  grandparentSlug?: string | undefined;
  grandparentArt?: string | undefined;
  grandparentTheme?: string | undefined;
  Media?: Array<GetSearchAllLibrariesMedia$Outbound> | undefined;
  Genre?: Array<GetSearchAllLibrariesGenre$Outbound> | undefined;
  Country?: Array<GetSearchAllLibrariesCountry$Outbound> | undefined;
  Director?: Array<GetSearchAllLibrariesDirector$Outbound> | undefined;
  Writer?: Array<GetSearchAllLibrariesWriter$Outbound> | undefined;
  Collection?: Array<GetSearchAllLibrariesCollection$Outbound> | undefined;
  Role?: Array<GetSearchAllLibrariesRole$Outbound> | undefined;
  Location?: Array<GetSearchAllLibrariesLocation$Outbound> | undefined;
  Guid?: Array<GetSearchAllLibrariesMediaGuid$Outbound> | undefined;
  UltraBlurColors?: GetSearchAllLibrariesUltraBlurColors$Outbound | undefined;
  Rating?: Array<GetSearchAllLibrariesMetaDataRating$Outbound> | undefined;
  Image?: Array<GetSearchAllLibrariesImage$Outbound> | undefined;
  titleSort?: string | undefined;
  viewCount?: number | undefined;
  lastViewedAt?: number | undefined;
  originalTitle?: string | undefined;
  viewOffset?: number | undefined;
  skipCount?: number | undefined;
  index?: number | undefined;
  theme?: string | undefined;
  leafCount?: number | undefined;
  viewedLeafCount?: number | undefined;
  childCount?: number | undefined;
  hasPremiumExtras?: string | undefined;
  hasPremiumPrimaryExtra?: string | undefined;
  parentRatingKey?: string | undefined;
  parentGuid?: string | undefined;
  parentStudio?: string | undefined;
  parentKey?: string | undefined;
  parentTitle?: string | undefined;
  parentIndex?: number | undefined;
  parentYear?: number | undefined;
  parentThumb?: string | undefined;
  parentTheme?: string | undefined;
};

/** @internal */
export const GetSearchAllLibrariesMetadata$outboundSchema: z.ZodType<
  GetSearchAllLibrariesMetadata$Outbound,
  z.ZodTypeDef,
  GetSearchAllLibrariesMetadata
> = z.object({
  ratingKey: z.string(),
  key: z.string(),
  guid: z.string(),
  studio: z.string().optional(),
  skipChildren: z.boolean().optional(),
  librarySectionID: z.number().int().optional(),
  librarySectionTitle: z.string().optional(),
  librarySectionKey: z.string().optional(),
  type: GetSearchAllLibrariesType$outboundSchema,
  title: z.string(),
  slug: z.string().optional(),
  contentRating: z.string().optional(),
  summary: z.string(),
  rating: z.number().optional(),
  audienceRating: z.number().optional(),
  year: z.number().int().optional(),
  seasonCount: z.number().int().optional(),
  tagline: z.string().optional(),
  flattenSeasons: GetSearchAllLibrariesFlattenSeasons$outboundSchema.optional(),
  episodeSort: GetSearchAllLibrariesEpisodeSort$outboundSchema.optional(),
  enableCreditsMarkerGeneration:
    GetSearchAllLibrariesEnableCreditsMarkerGeneration$outboundSchema
      .optional(),
  showOrdering: GetSearchAllLibrariesShowOrdering$outboundSchema.optional(),
  thumb: z.string().optional(),
  art: z.string().optional(),
  banner: z.string().optional(),
  duration: z.number().int().optional(),
  originallyAvailableAt: z.instanceof(RFCDate).transform(v => v.toString())
    .optional(),
  addedAt: z.number().int(),
  updatedAt: z.number().int().optional(),
  audienceRatingImage: z.string().optional(),
  chapterSource: z.string().optional(),
  primaryExtraKey: z.string().optional(),
  ratingImage: z.string().optional(),
  grandparentRatingKey: z.string().optional(),
  grandparentGuid: z.string().optional(),
  grandparentKey: z.string().optional(),
  grandparentTitle: z.string().optional(),
  grandparentThumb: z.string().optional(),
  parentSlug: z.string().optional(),
  grandparentSlug: z.string().optional(),
  grandparentArt: z.string().optional(),
  grandparentTheme: z.string().optional(),
  media: z.array(z.lazy(() => GetSearchAllLibrariesMedia$outboundSchema))
    .optional(),
  genre: z.array(z.lazy(() => GetSearchAllLibrariesGenre$outboundSchema))
    .optional(),
  country: z.array(z.lazy(() => GetSearchAllLibrariesCountry$outboundSchema))
    .optional(),
  director: z.array(z.lazy(() => GetSearchAllLibrariesDirector$outboundSchema))
    .optional(),
  writer: z.array(z.lazy(() => GetSearchAllLibrariesWriter$outboundSchema))
    .optional(),
  collection: z.array(
    z.lazy(() => GetSearchAllLibrariesCollection$outboundSchema),
  ).optional(),
  role: z.array(z.lazy(() => GetSearchAllLibrariesRole$outboundSchema))
    .optional(),
  location: z.array(z.lazy(() => GetSearchAllLibrariesLocation$outboundSchema))
    .optional(),
  mediaGuid: z.array(
    z.lazy(() => GetSearchAllLibrariesMediaGuid$outboundSchema),
  ).optional(),
  ultraBlurColors: z.lazy(() =>
    GetSearchAllLibrariesUltraBlurColors$outboundSchema
  ).optional(),
  metaDataRating: z.array(
    z.lazy(() => GetSearchAllLibrariesMetaDataRating$outboundSchema),
  ).optional(),
  image: z.array(z.lazy(() => GetSearchAllLibrariesImage$outboundSchema))
    .optional(),
  titleSort: z.string().optional(),
  viewCount: z.number().int().optional(),
  lastViewedAt: z.number().int().optional(),
  originalTitle: z.string().optional(),
  viewOffset: z.number().int().optional(),
  skipCount: z.number().int().optional(),
  index: z.number().int().optional(),
  theme: z.string().optional(),
  leafCount: z.number().int().optional(),
  viewedLeafCount: z.number().int().optional(),
  childCount: z.number().int().optional(),
  hasPremiumExtras: z.string().optional(),
  hasPremiumPrimaryExtra: z.string().optional(),
  parentRatingKey: z.string().optional(),
  parentGuid: z.string().optional(),
  parentStudio: z.string().optional(),
  parentKey: z.string().optional(),
  parentTitle: z.string().optional(),
  parentIndex: z.number().int().optional(),
  parentYear: z.number().int().optional(),
  parentThumb: z.string().optional(),
  parentTheme: z.string().optional(),
}).transform((v) => {
  return remap$(v, {
    media: "Media",
    genre: "Genre",
    country: "Country",
    director: "Director",
    writer: "Writer",
    collection: "Collection",
    role: "Role",
    location: "Location",
    mediaGuid: "Guid",
    ultraBlurColors: "UltraBlurColors",
    metaDataRating: "Rating",
    image: "Image",
  });
});

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

export function getSearchAllLibrariesMetadataToJSON(
  getSearchAllLibrariesMetadata: GetSearchAllLibrariesMetadata,
): string {
  return JSON.stringify(
    GetSearchAllLibrariesMetadata$outboundSchema.parse(
      getSearchAllLibrariesMetadata,
    ),
  );
}

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

/** @internal */
export const SearchResult$inboundSchema: z.ZodType<
  SearchResult,
  z.ZodTypeDef,
  unknown
> = z.object({
  score: z.number(),
  Metadata: z.lazy(() => GetSearchAllLibrariesMetadata$inboundSchema),
}).transform((v) => {
  return remap$(v, {
    "Metadata": "metadata",
  });
});

/** @internal */
export type SearchResult$Outbound = {
  score: number;
  Metadata: GetSearchAllLibrariesMetadata$Outbound;
};

/** @internal */
export const SearchResult$outboundSchema: z.ZodType<
  SearchResult$Outbound,
  z.ZodTypeDef,
  SearchResult
> = z.object({
  score: z.number(),
  metadata: z.lazy(() => GetSearchAllLibrariesMetadata$outboundSchema),
}).transform((v) => {
  return remap$(v, {
    metadata: "Metadata",
  });
});

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

export function searchResultToJSON(searchResult: SearchResult): string {
  return JSON.stringify(SearchResult$outboundSchema.parse(searchResult));
}

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

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

/** @internal */
export type GetSearchAllLibrariesMediaContainer$Outbound = {
  size: number;
  SearchResult: Array<SearchResult$Outbound>;
};

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

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

export function getSearchAllLibrariesMediaContainerToJSON(
  getSearchAllLibrariesMediaContainer: GetSearchAllLibrariesMediaContainer,
): string {
  return JSON.stringify(
    GetSearchAllLibrariesMediaContainer$outboundSchema.parse(
      getSearchAllLibrariesMediaContainer,
    ),
  );
}

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

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

/** @internal */
export type GetSearchAllLibrariesResponseBody$Outbound = {
  MediaContainer: GetSearchAllLibrariesMediaContainer$Outbound;
};

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

export function getSearchAllLibrariesResponseBodyToJSON(
  getSearchAllLibrariesResponseBody: GetSearchAllLibrariesResponseBody,
): string {
  return JSON.stringify(
    GetSearchAllLibrariesResponseBody$outboundSchema.parse(
      getSearchAllLibrariesResponseBody,
    ),
  );
}

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

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

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

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

export function getSearchAllLibrariesResponseToJSON(
  getSearchAllLibrariesResponse: GetSearchAllLibrariesResponse,
): string {
  return JSON.stringify(
    GetSearchAllLibrariesResponse$outboundSchema.parse(
      getSearchAllLibrariesResponse,
    ),
  );
}

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