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

import * as z from "zod";
import { remap as remap$ } from "../../../lib/primitives.js";
import { safeParse } from "../../../lib/schemas.js";
import { Result as SafeParseResult } from "../../types/fp.js";
import { SDKValidationError } from "../errors/sdkvalidationerror.js";

/**
 * 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 GetActorsLibraryQueryParamType {
  Movie = 1,
  TvShow = 2,
  Season = 3,
  Episode = 4,
  Audio = 8,
  Album = 9,
  Track = 10,
}

export type GetActorsLibraryRequest = {
  /**
   * 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: GetActorsLibraryQueryParamType;
};

export type GetActorsLibraryDirectory = {
  /**
   * A fast lookup key for the actor relative url.
   */
  fastKey: string;
  /**
   * URL for the thumbnail image of the actor.
   */
  thumb: string;
  /**
   * A unique key representing the actor.
   */
  key: string;
  /**
   * The name of the actor.
   */
  title: string;
};

export type GetActorsLibraryMediaContainer = {
  /**
   * Number of media items returned in this response.
   */
  size: number;
  /**
   * Indicates whether syncing is allowed.
   */
  allowSync: boolean;
  /**
   * URL for the background artwork of the media container.
   */
  art: string;
  /**
   * An plugin identifier for the media container.
   */
  identifier: string;
  /**
   * The prefix used for media tag resource paths.
   */
  mediaTagPrefix: string;
  /**
   * The version number for media tags.
   */
  mediaTagVersion: number;
  /**
   * Specifies whether caching is disabled.
   */
  nocache: boolean;
  /**
   * URL for the thumbnail image of the media container.
   */
  thumb: string;
  /**
   * 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;
  /**
   * Identifier for the view mode.
   */
  viewMode: string;
  /**
   * An array of actor entries for media items.
   */
  directory?: Array<GetActorsLibraryDirectory> | undefined;
};

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

export type GetActorsLibraryResponse = {
  /**
   * 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?: GetActorsLibraryResponseBody | undefined;
};

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

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

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

/** @internal */
export const GetActorsLibraryRequest$inboundSchema: z.ZodType<
  GetActorsLibraryRequest,
  z.ZodTypeDef,
  unknown
> = z.object({
  sectionKey: z.number().int(),
  type: GetActorsLibraryQueryParamType$inboundSchema,
});

/** @internal */
export type GetActorsLibraryRequest$Outbound = {
  sectionKey: number;
  type: number;
};

/** @internal */
export const GetActorsLibraryRequest$outboundSchema: z.ZodType<
  GetActorsLibraryRequest$Outbound,
  z.ZodTypeDef,
  GetActorsLibraryRequest
> = z.object({
  sectionKey: z.number().int(),
  type: GetActorsLibraryQueryParamType$outboundSchema,
});

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

export function getActorsLibraryRequestToJSON(
  getActorsLibraryRequest: GetActorsLibraryRequest,
): string {
  return JSON.stringify(
    GetActorsLibraryRequest$outboundSchema.parse(getActorsLibraryRequest),
  );
}

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

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

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

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

export function getActorsLibraryDirectoryToJSON(
  getActorsLibraryDirectory: GetActorsLibraryDirectory,
): string {
  return JSON.stringify(
    GetActorsLibraryDirectory$outboundSchema.parse(getActorsLibraryDirectory),
  );
}

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

/** @internal */
export const GetActorsLibraryMediaContainer$inboundSchema: z.ZodType<
  GetActorsLibraryMediaContainer,
  z.ZodTypeDef,
  unknown
> = z.object({
  size: z.number().int(),
  allowSync: z.boolean(),
  art: z.string(),
  identifier: z.string(),
  mediaTagPrefix: z.string(),
  mediaTagVersion: z.number().int(),
  nocache: z.boolean(),
  thumb: z.string(),
  title1: z.string(),
  title2: z.string(),
  viewGroup: z.string(),
  viewMode: z.string(),
  Directory: z.array(z.lazy(() => GetActorsLibraryDirectory$inboundSchema))
    .optional(),
}).transform((v) => {
  return remap$(v, {
    "Directory": "directory",
  });
});

/** @internal */
export type GetActorsLibraryMediaContainer$Outbound = {
  size: number;
  allowSync: boolean;
  art: string;
  identifier: string;
  mediaTagPrefix: string;
  mediaTagVersion: number;
  nocache: boolean;
  thumb: string;
  title1: string;
  title2: string;
  viewGroup: string;
  viewMode: string;
  Directory?: Array<GetActorsLibraryDirectory$Outbound> | undefined;
};

/** @internal */
export const GetActorsLibraryMediaContainer$outboundSchema: z.ZodType<
  GetActorsLibraryMediaContainer$Outbound,
  z.ZodTypeDef,
  GetActorsLibraryMediaContainer
> = z.object({
  size: z.number().int(),
  allowSync: z.boolean(),
  art: z.string(),
  identifier: z.string(),
  mediaTagPrefix: z.string(),
  mediaTagVersion: z.number().int(),
  nocache: z.boolean(),
  thumb: z.string(),
  title1: z.string(),
  title2: z.string(),
  viewGroup: z.string(),
  viewMode: z.string(),
  directory: z.array(z.lazy(() => GetActorsLibraryDirectory$outboundSchema))
    .optional(),
}).transform((v) => {
  return remap$(v, {
    directory: "Directory",
  });
});

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

export function getActorsLibraryMediaContainerToJSON(
  getActorsLibraryMediaContainer: GetActorsLibraryMediaContainer,
): string {
  return JSON.stringify(
    GetActorsLibraryMediaContainer$outboundSchema.parse(
      getActorsLibraryMediaContainer,
    ),
  );
}

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

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

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

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

export function getActorsLibraryResponseBodyToJSON(
  getActorsLibraryResponseBody: GetActorsLibraryResponseBody,
): string {
  return JSON.stringify(
    GetActorsLibraryResponseBody$outboundSchema.parse(
      getActorsLibraryResponseBody,
    ),
  );
}

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

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

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

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

export function getActorsLibraryResponseToJSON(
  getActorsLibraryResponse: GetActorsLibraryResponse,
): string {
  return JSON.stringify(
    GetActorsLibraryResponse$outboundSchema.parse(getActorsLibraryResponse),
  );
}

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