/*
 * 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 ClearPlaylistContentsRequest = {
  /**
   * the ID of the playlist
   */
  playlistID: number;
};

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

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

/** @internal */
export type ClearPlaylistContentsRequest$Outbound = {
  playlistID: number;
};

/** @internal */
export const ClearPlaylistContentsRequest$outboundSchema: z.ZodType<
  ClearPlaylistContentsRequest$Outbound,
  z.ZodTypeDef,
  ClearPlaylistContentsRequest
> = z.object({
  playlistID: z.number(),
});

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

export function clearPlaylistContentsRequestToJSON(
  clearPlaylistContentsRequest: ClearPlaylistContentsRequest,
): string {
  return JSON.stringify(
    ClearPlaylistContentsRequest$outboundSchema.parse(
      clearPlaylistContentsRequest,
    ),
  );
}

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

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

/** @internal */
export type ClearPlaylistContentsResponse$Outbound = {
  ContentType: string;
  StatusCode: number;
  RawResponse: never;
};

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

export function clearPlaylistContentsResponseToJSON(
  clearPlaylistContentsResponse: ClearPlaylistContentsResponse,
): string {
  return JSON.stringify(
    ClearPlaylistContentsResponse$outboundSchema.parse(
      clearPlaylistContentsResponse,
    ),
  );
}

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