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

export type Setting = {
  id?: string | undefined;
  label?: string | undefined;
  summary?: string | undefined;
  type?: string | undefined;
  default?: boolean | undefined;
  value?: boolean | undefined;
  hidden?: boolean | undefined;
  advanced?: boolean | undefined;
  group?: string | undefined;
  enumValues?: string | undefined;
};

export type GetServerPreferencesMediaContainer = {
  size?: number | undefined;
  setting?: Array<Setting> | undefined;
};

/**
 * Server Preferences
 */
export type GetServerPreferencesResponseBody = {
  mediaContainer?: GetServerPreferencesMediaContainer | undefined;
};

export type GetServerPreferencesResponse = {
  /**
   * 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;
  /**
   * Server Preferences
   */
  object?: GetServerPreferencesResponseBody | undefined;
};

/** @internal */
export const Setting$inboundSchema: z.ZodType<Setting, z.ZodTypeDef, unknown> =
  z.object({
    id: z.string().optional(),
    label: z.string().optional(),
    summary: z.string().optional(),
    type: z.string().optional(),
    default: z.boolean().optional(),
    value: z.boolean().optional(),
    hidden: z.boolean().optional(),
    advanced: z.boolean().optional(),
    group: z.string().optional(),
    enumValues: z.string().optional(),
  });

/** @internal */
export type Setting$Outbound = {
  id?: string | undefined;
  label?: string | undefined;
  summary?: string | undefined;
  type?: string | undefined;
  default?: boolean | undefined;
  value?: boolean | undefined;
  hidden?: boolean | undefined;
  advanced?: boolean | undefined;
  group?: string | undefined;
  enumValues?: string | undefined;
};

/** @internal */
export const Setting$outboundSchema: z.ZodType<
  Setting$Outbound,
  z.ZodTypeDef,
  Setting
> = z.object({
  id: z.string().optional(),
  label: z.string().optional(),
  summary: z.string().optional(),
  type: z.string().optional(),
  default: z.boolean().optional(),
  value: z.boolean().optional(),
  hidden: z.boolean().optional(),
  advanced: z.boolean().optional(),
  group: z.string().optional(),
  enumValues: 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 Setting$ {
  /** @deprecated use `Setting$inboundSchema` instead. */
  export const inboundSchema = Setting$inboundSchema;
  /** @deprecated use `Setting$outboundSchema` instead. */
  export const outboundSchema = Setting$outboundSchema;
  /** @deprecated use `Setting$Outbound` instead. */
  export type Outbound = Setting$Outbound;
}

export function settingToJSON(setting: Setting): string {
  return JSON.stringify(Setting$outboundSchema.parse(setting));
}

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

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

/** @internal */
export type GetServerPreferencesMediaContainer$Outbound = {
  size?: number | undefined;
  Setting?: Array<Setting$Outbound> | undefined;
};

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

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

export function getServerPreferencesMediaContainerToJSON(
  getServerPreferencesMediaContainer: GetServerPreferencesMediaContainer,
): string {
  return JSON.stringify(
    GetServerPreferencesMediaContainer$outboundSchema.parse(
      getServerPreferencesMediaContainer,
    ),
  );
}

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

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

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

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

export function getServerPreferencesResponseBodyToJSON(
  getServerPreferencesResponseBody: GetServerPreferencesResponseBody,
): string {
  return JSON.stringify(
    GetServerPreferencesResponseBody$outboundSchema.parse(
      getServerPreferencesResponseBody,
    ),
  );
}

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

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

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

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

export function getServerPreferencesResponseToJSON(
  getServerPreferencesResponse: GetServerPreferencesResponse,
): string {
  return JSON.stringify(
    GetServerPreferencesResponse$outboundSchema.parse(
      getServerPreferencesResponse,
    ),
  );
}

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