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

import * as z from "zod";
import * as b64$ from "../../../lib/base64.js";
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";

export const GetUsersServerList = [
  "https://plex.tv/api",
] as const;

export type GetUsersRequest = {
  /**
   * An opaque identifier unique to the client (UUID, serial number, or other unique device ID)
   */
  clientID: string;
  /**
   * The name of the client application. (Plex Web, Plex Media Server, etc.)
   */
  clientName?: string | undefined;
  /**
   * A relatively friendly name for the client device
   */
  deviceNickname?: string | undefined;
  /**
   * The name of the device the client application is running on. This is used to track the client application and its usage. (Chrome, Safari, etc.)
   */
  deviceName?: string | undefined;
  /**
   * The resolution of the device the client application is running on. This is used to track the client application and its usage. (1487x1165,2560x1440)
   */
  deviceScreenResolution?: string | undefined;
  /**
   * The version of the client application.
   */
  clientVersion?: string | undefined;
  /**
   * The platform of the client application.
   */
  platform?: string | undefined;
  /**
   * The features of the client application. This is used to track the client application and its usage. (external-media,indirect-media,hub-style-list)
   */
  clientFeatures?: string | undefined;
  /**
   * A potentially less friendly identifier for the device model
   */
  model?: string | undefined;
  /**
   * The session ID of the client application. This is used to track the client application and its usage. (97e136ef-4ddd-4ff3-89a7-a5820c96c2ca)
   */
  xPlexSessionId?: string | undefined;
  /**
   * The language of the client application.
   */
  xPlexLanguage?: string | undefined;
  /**
   * The version of the platform
   */
  platformVersion?: string | undefined;
  /**
   * An authentication token, obtained from plex.tv
   */
  xPlexToken: string;
};

/**
 * Indicates whether the account is protected.
 */
export enum Protected {
  Disable = 0,
  Enable = 1,
}

/**
 * Indicates if the user is part of a home group.
 */
export enum Home {
  Disable = 0,
  Enable = 1,
}

/**
 * Indicates if the user is allowed to use tuners.
 */
export enum AllowTuners {
  Disable = 0,
  Enable = 1,
}

/**
 * Indicates if the user is allowed to sync media.
 */
export enum AllowSync {
  Disable = 0,
  Enable = 1,
}

/**
 * Indicates if the user is allowed to upload from a camera.
 */
export enum AllowCameraUpload {
  Disable = 0,
  Enable = 1,
}

/**
 * Indicates if the user has access to channels.
 */
export enum AllowChannels {
  Disable = 0,
  Enable = 1,
}

/**
 * Indicates if the user can manage subtitles.
 */
export enum AllowSubtitleAdmin {
  Disable = 0,
  Enable = 1,
}

/**
 * Indicates if the user has restricted access.
 */
export enum Restricted {
  Disable = 0,
  Enable = 1,
}

/**
 * Indicates if the user has access to all libraries.
 */
export enum AllLibraries {
  Disable = 0,
  Enable = 1,
}

/**
 * Indicates if the user owns the server.
 */
export enum Owned {
  Disable = 0,
  Enable = 1,
}

/**
 * Indicates if the server is pending approval.
 */
export enum Pending {
  Disable = 0,
  Enable = 1,
}

export type GetUsersServer = {
  /**
   * Unique ID of the server of the connected user
   */
  id: number;
  /**
   * ID of the actual Plex server.
   */
  serverId: number;
  /**
   * Machine identifier of the Plex server.
   */
  machineIdentifier: string;
  /**
   * Name of the Plex server of the connected user.
   */
  name: string;
  lastSeenAt: number;
  /**
   * Number of libraries in the server this user has access to.
   */
  numLibraries: number;
  allLibraries?: AllLibraries | undefined;
  owned?: Owned | undefined;
  pending?: Pending | undefined;
};

export type User = {
  /**
   * User's unique ID.
   */
  id: number;
  /**
   * User's display name.
   */
  title: string;
  /**
   * User's username.
   */
  username: string;
  /**
   * User's email address.
   */
  email: string;
  /**
   * ID of the user's recommendation playlist.
   */
  recommendationsPlaylistId?: string | null | undefined;
  /**
   * URL to the user's avatar image.
   */
  thumb: string;
  protected?: Protected | undefined;
  home?: Home | undefined;
  allowTuners?: AllowTuners | undefined;
  allowSync?: AllowSync | undefined;
  allowCameraUpload?: AllowCameraUpload | undefined;
  allowChannels?: AllowChannels | undefined;
  allowSubtitleAdmin?: AllowSubtitleAdmin | undefined;
  /**
   * Filters applied for all content.
   */
  filterAll?: string | null | undefined;
  /**
   * Filters applied for movies.
   */
  filterMovies?: string | null | undefined;
  /**
   * Filters applied for music.
   */
  filterMusic?: string | null | undefined;
  /**
   * Filters applied for photos.
   */
  filterPhotos?: string | null | undefined;
  /**
   * Filters applied for television.
   */
  filterTelevision?: string | undefined;
  restricted?: Restricted | undefined;
  /**
   * List of servers owned by the user.
   */
  server: Array<GetUsersServer>;
};

/**
 * Container holding user and server details.
 */
export type GetUsersMediaContainer = {
  /**
   * The friendly name of the Plex instance.
   */
  friendlyName: string;
  identifier: string;
  /**
   * Unique Machine identifier of the Plex server.
   */
  machineIdentifier: string;
  /**
   * Total number of users.
   */
  totalSize: number;
  /**
   * Number of users in the current response.
   */
  size: number;
  /**
   * List of users with access to the Plex server.
   */
  user: Array<User>;
};

/**
 * Successful response with media container data in XML
 */
export type GetUsersResponseBody = {
  /**
   * Container holding user and server details.
   */
  mediaContainer?: GetUsersMediaContainer | undefined;
};

export type GetUsersResponse = {
  /**
   * 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;
  body?: Uint8Array | string | undefined;
};

/** @internal */
export const GetUsersRequest$inboundSchema: z.ZodType<
  GetUsersRequest,
  z.ZodTypeDef,
  unknown
> = z.object({
  ClientID: z.string(),
  ClientName: z.string().optional(),
  DeviceNickname: z.string().optional(),
  DeviceName: z.string().optional(),
  DeviceScreenResolution: z.string().optional(),
  ClientVersion: z.string().optional(),
  Platform: z.string().optional(),
  ClientFeatures: z.string().optional(),
  Model: z.string().optional(),
  "X-Plex-Session-Id": z.string().optional(),
  "X-Plex-Language": z.string().optional(),
  PlatformVersion: z.string().optional(),
  "X-Plex-Token": z.string(),
}).transform((v) => {
  return remap$(v, {
    "ClientID": "clientID",
    "ClientName": "clientName",
    "DeviceNickname": "deviceNickname",
    "DeviceName": "deviceName",
    "DeviceScreenResolution": "deviceScreenResolution",
    "ClientVersion": "clientVersion",
    "Platform": "platform",
    "ClientFeatures": "clientFeatures",
    "Model": "model",
    "X-Plex-Session-Id": "xPlexSessionId",
    "X-Plex-Language": "xPlexLanguage",
    "PlatformVersion": "platformVersion",
    "X-Plex-Token": "xPlexToken",
  });
});

/** @internal */
export type GetUsersRequest$Outbound = {
  ClientID: string;
  ClientName?: string | undefined;
  DeviceNickname?: string | undefined;
  DeviceName?: string | undefined;
  DeviceScreenResolution?: string | undefined;
  ClientVersion?: string | undefined;
  Platform?: string | undefined;
  ClientFeatures?: string | undefined;
  Model?: string | undefined;
  "X-Plex-Session-Id"?: string | undefined;
  "X-Plex-Language"?: string | undefined;
  PlatformVersion?: string | undefined;
  "X-Plex-Token": string;
};

/** @internal */
export const GetUsersRequest$outboundSchema: z.ZodType<
  GetUsersRequest$Outbound,
  z.ZodTypeDef,
  GetUsersRequest
> = z.object({
  clientID: z.string(),
  clientName: z.string().optional(),
  deviceNickname: z.string().optional(),
  deviceName: z.string().optional(),
  deviceScreenResolution: z.string().optional(),
  clientVersion: z.string().optional(),
  platform: z.string().optional(),
  clientFeatures: z.string().optional(),
  model: z.string().optional(),
  xPlexSessionId: z.string().optional(),
  xPlexLanguage: z.string().optional(),
  platformVersion: z.string().optional(),
  xPlexToken: z.string(),
}).transform((v) => {
  return remap$(v, {
    clientID: "ClientID",
    clientName: "ClientName",
    deviceNickname: "DeviceNickname",
    deviceName: "DeviceName",
    deviceScreenResolution: "DeviceScreenResolution",
    clientVersion: "ClientVersion",
    platform: "Platform",
    clientFeatures: "ClientFeatures",
    model: "Model",
    xPlexSessionId: "X-Plex-Session-Id",
    xPlexLanguage: "X-Plex-Language",
    platformVersion: "PlatformVersion",
    xPlexToken: "X-Plex-Token",
  });
});

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

export function getUsersRequestToJSON(
  getUsersRequest: GetUsersRequest,
): string {
  return JSON.stringify(GetUsersRequest$outboundSchema.parse(getUsersRequest));
}

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

/** @internal */
export const GetUsersServer$inboundSchema: z.ZodType<
  GetUsersServer,
  z.ZodTypeDef,
  unknown
> = z.object({
  id: z.number().int(),
  serverId: z.number().int(),
  machineIdentifier: z.string(),
  name: z.string(),
  lastSeenAt: z.number().int(),
  numLibraries: z.number().int(),
  allLibraries: AllLibraries$inboundSchema,
  owned: Owned$inboundSchema,
  pending: Pending$inboundSchema,
});

/** @internal */
export type GetUsersServer$Outbound = {
  id: number;
  serverId: number;
  machineIdentifier: string;
  name: string;
  lastSeenAt: number;
  numLibraries: number;
  allLibraries: number;
  owned: number;
  pending: number;
};

/** @internal */
export const GetUsersServer$outboundSchema: z.ZodType<
  GetUsersServer$Outbound,
  z.ZodTypeDef,
  GetUsersServer
> = z.object({
  id: z.number().int(),
  serverId: z.number().int(),
  machineIdentifier: z.string(),
  name: z.string(),
  lastSeenAt: z.number().int(),
  numLibraries: z.number().int(),
  allLibraries: AllLibraries$outboundSchema.default(AllLibraries.Disable),
  owned: Owned$outboundSchema.default(Owned.Disable),
  pending: Pending$outboundSchema.default(Pending.Disable),
});

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

export function getUsersServerToJSON(getUsersServer: GetUsersServer): string {
  return JSON.stringify(GetUsersServer$outboundSchema.parse(getUsersServer));
}

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

/** @internal */
export const User$inboundSchema: z.ZodType<User, z.ZodTypeDef, unknown> = z
  .object({
    id: z.number().int(),
    title: z.string(),
    username: z.string(),
    email: z.string(),
    recommendationsPlaylistId: z.nullable(z.string()).optional(),
    thumb: z.string(),
    protected: Protected$inboundSchema,
    home: Home$inboundSchema,
    allowTuners: AllowTuners$inboundSchema,
    allowSync: AllowSync$inboundSchema,
    allowCameraUpload: AllowCameraUpload$inboundSchema,
    allowChannels: AllowChannels$inboundSchema,
    allowSubtitleAdmin: AllowSubtitleAdmin$inboundSchema,
    filterAll: z.nullable(z.string()).optional(),
    filterMovies: z.nullable(z.string()).optional(),
    filterMusic: z.nullable(z.string()).optional(),
    filterPhotos: z.nullable(z.string()).optional(),
    filterTelevision: z.string().optional(),
    restricted: Restricted$inboundSchema,
    Server: z.array(z.lazy(() => GetUsersServer$inboundSchema)),
  }).transform((v) => {
    return remap$(v, {
      "Server": "server",
    });
  });

/** @internal */
export type User$Outbound = {
  id: number;
  title: string;
  username: string;
  email: string;
  recommendationsPlaylistId?: string | null | undefined;
  thumb: string;
  protected: number;
  home: number;
  allowTuners: number;
  allowSync: number;
  allowCameraUpload: number;
  allowChannels: number;
  allowSubtitleAdmin: number;
  filterAll?: string | null | undefined;
  filterMovies?: string | null | undefined;
  filterMusic?: string | null | undefined;
  filterPhotos?: string | null | undefined;
  filterTelevision?: string | undefined;
  restricted: number;
  Server: Array<GetUsersServer$Outbound>;
};

/** @internal */
export const User$outboundSchema: z.ZodType<User$Outbound, z.ZodTypeDef, User> =
  z.object({
    id: z.number().int(),
    title: z.string(),
    username: z.string(),
    email: z.string(),
    recommendationsPlaylistId: z.nullable(z.string()).optional(),
    thumb: z.string(),
    protected: Protected$outboundSchema.default(Protected.Disable),
    home: Home$outboundSchema.default(Home.Disable),
    allowTuners: AllowTuners$outboundSchema.default(AllowTuners.Disable),
    allowSync: AllowSync$outboundSchema.default(AllowSync.Disable),
    allowCameraUpload: AllowCameraUpload$outboundSchema.default(
      AllowCameraUpload.Disable,
    ),
    allowChannels: AllowChannels$outboundSchema.default(AllowChannels.Disable),
    allowSubtitleAdmin: AllowSubtitleAdmin$outboundSchema.default(
      AllowSubtitleAdmin.Disable,
    ),
    filterAll: z.nullable(z.string()).optional(),
    filterMovies: z.nullable(z.string()).optional(),
    filterMusic: z.nullable(z.string()).optional(),
    filterPhotos: z.nullable(z.string()).optional(),
    filterTelevision: z.string().optional(),
    restricted: Restricted$outboundSchema.default(Restricted.Disable),
    server: z.array(z.lazy(() => GetUsersServer$outboundSchema)),
  }).transform((v) => {
    return remap$(v, {
      server: "Server",
    });
  });

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

export function userToJSON(user: User): string {
  return JSON.stringify(User$outboundSchema.parse(user));
}

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

/** @internal */
export const GetUsersMediaContainer$inboundSchema: z.ZodType<
  GetUsersMediaContainer,
  z.ZodTypeDef,
  unknown
> = z.object({
  friendlyName: z.string(),
  identifier: z.string(),
  machineIdentifier: z.string(),
  totalSize: z.number().int(),
  size: z.number().int(),
  User: z.array(z.lazy(() => User$inboundSchema)),
}).transform((v) => {
  return remap$(v, {
    "User": "user",
  });
});

/** @internal */
export type GetUsersMediaContainer$Outbound = {
  friendlyName: string;
  identifier: string;
  machineIdentifier: string;
  totalSize: number;
  size: number;
  User: Array<User$Outbound>;
};

/** @internal */
export const GetUsersMediaContainer$outboundSchema: z.ZodType<
  GetUsersMediaContainer$Outbound,
  z.ZodTypeDef,
  GetUsersMediaContainer
> = z.object({
  friendlyName: z.string(),
  identifier: z.string(),
  machineIdentifier: z.string(),
  totalSize: z.number().int(),
  size: z.number().int(),
  user: z.array(z.lazy(() => User$outboundSchema)),
}).transform((v) => {
  return remap$(v, {
    user: "User",
  });
});

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

export function getUsersMediaContainerToJSON(
  getUsersMediaContainer: GetUsersMediaContainer,
): string {
  return JSON.stringify(
    GetUsersMediaContainer$outboundSchema.parse(getUsersMediaContainer),
  );
}

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

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

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

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

export function getUsersResponseBodyToJSON(
  getUsersResponseBody: GetUsersResponseBody,
): string {
  return JSON.stringify(
    GetUsersResponseBody$outboundSchema.parse(getUsersResponseBody),
  );
}

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

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

/** @internal */
export type GetUsersResponse$Outbound = {
  ContentType: string;
  StatusCode: number;
  RawResponse: never;
  Body?: Uint8Array | undefined;
};

/** @internal */
export const GetUsersResponse$outboundSchema: z.ZodType<
  GetUsersResponse$Outbound,
  z.ZodTypeDef,
  GetUsersResponse
> = z.object({
  contentType: z.string(),
  statusCode: z.number().int(),
  rawResponse: z.instanceof(Response).transform(() => {
    throw new Error("Response cannot be serialized");
  }),
  body: b64$.zodOutbound.optional(),
}).transform((v) => {
  return remap$(v, {
    contentType: "ContentType",
    statusCode: "StatusCode",
    rawResponse: "RawResponse",
    body: "Body",
  });
});

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

export function getUsersResponseToJSON(
  getUsersResponse: GetUsersResponse,
): string {
  return JSON.stringify(
    GetUsersResponse$outboundSchema.parse(getUsersResponse),
  );
}

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