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

import * as z from "zod/v3";
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";
import { Metadata, Metadata$inboundSchema } from "./metadata.js";

export type SlashGetResponses200MediaContainer = {
  /**
   * The flavors of directory found here:
   *
   * @remarks
   *   - Primary: (e.g. all, On Deck) These are still used in some clients to provide "shortcuts" to subsets of media. However, with the exception of On Deck, all of them can be created by media queries, and the desire is to allow these to be customized by users.
   *   - Secondary: These are marked with `"secondary": true` and were used by old clients to provide nested menus allowing for primative (but structured) navigation.
   *   - Special: There is a By Folder entry which allows browsing the media by the underlying filesystem structure, and there's a completely obsolete entry marked `"search": true` which used to be used to allow clients to build search dialogs on the fly.
   */
  content?: string | undefined;
  allowSync?: boolean | undefined;
  art?: string | undefined;
  directory?: Array<Metadata> | undefined;
  identifier?: string | undefined;
  librarySectionID?: number | undefined;
  mediaTagPrefix?: string | undefined;
  mediaTagVersion?: number | undefined;
  size?: number | undefined;
  sortAsc?: boolean | undefined;
  thumb?: string | undefined;
  title1?: string | undefined;
  viewGroup?: string | undefined;
  viewMode?: number | undefined;
};

/**
 * OK
 */
export type SlashGetResponses200 = {
  mediaContainer?: SlashGetResponses200MediaContainer | undefined;
};

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

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

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

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