/*
 * 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 StopTranscodeSessionRequest = {
  /**
   * the Key of the transcode session to stop
   */
  sessionKey: string;
};

export type StopTranscodeSessionResponse = {
  /**
   * 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 StopTranscodeSessionRequest$inboundSchema: z.ZodType<
  StopTranscodeSessionRequest,
  z.ZodTypeDef,
  unknown
> = z.object({
  sessionKey: z.string(),
});

/** @internal */
export type StopTranscodeSessionRequest$Outbound = {
  sessionKey: string;
};

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

export function stopTranscodeSessionRequestToJSON(
  stopTranscodeSessionRequest: StopTranscodeSessionRequest,
): string {
  return JSON.stringify(
    StopTranscodeSessionRequest$outboundSchema.parse(
      stopTranscodeSessionRequest,
    ),
  );
}

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

/** @internal */
export const StopTranscodeSessionResponse$inboundSchema: z.ZodType<
  StopTranscodeSessionResponse,
  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 StopTranscodeSessionResponse$Outbound = {
  ContentType: string;
  StatusCode: number;
  RawResponse: never;
};

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

export function stopTranscodeSessionResponseToJSON(
  stopTranscodeSessionResponse: StopTranscodeSessionResponse,
): string {
  return JSON.stringify(
    StopTranscodeSessionResponse$outboundSchema.parse(
      stopTranscodeSessionResponse,
    ),
  );
}

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