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

import { transcoderMakeDecision } from "../funcs/transcoderMakeDecision.js";
import { transcoderStartTranscodeSession } from "../funcs/transcoderStartTranscodeSession.js";
import {
  TranscodeImageAcceptEnum,
  transcoderTranscodeImage,
} from "../funcs/transcoderTranscodeImage.js";
import { transcoderTranscodeSubtitles } from "../funcs/transcoderTranscodeSubtitles.js";
import { transcoderTriggerFallback } from "../funcs/transcoderTriggerFallback.js";
import { ClientSDK, RequestOptions } from "../lib/sdks.js";
import * as operations from "./models/operations/index.js";
import { unwrapAsync } from "./types/fp.js";

export { TranscodeImageAcceptEnum } from "../funcs/transcoderTranscodeImage.js";

export class Transcoder extends ClientSDK {
  /**
   * Transcode an image
   *
   * @remarks
   * Transcode an image, possibly changing format or size
   */
  async transcodeImage(
    request: operations.TranscodeImageRequest,
    options?: RequestOptions & {
      acceptHeaderOverride?: TranscodeImageAcceptEnum;
    },
  ): Promise<operations.TranscodeImageResponse> {
    return unwrapAsync(transcoderTranscodeImage(
      this,
      request,
      options,
    ));
  }

  /**
   * Make a decision on media playback
   *
   * @remarks
   * Make a decision on media playback based on client profile, and requested settings such as bandwidth and resolution.
   */
  async makeDecision(
    request: operations.MakeDecisionRequest,
    options?: RequestOptions,
  ): Promise<operations.MakeDecisionResponse> {
    return unwrapAsync(transcoderMakeDecision(
      this,
      request,
      options,
    ));
  }

  /**
   * Manually trigger a transcoder fallback
   *
   * @remarks
   * Manually trigger a transcoder fallback ex: HEVC to h.264 or hw to sw
   */
  async triggerFallback(
    request: operations.TriggerFallbackRequest,
    options?: RequestOptions,
  ): Promise<operations.TriggerFallbackResponse> {
    return unwrapAsync(transcoderTriggerFallback(
      this,
      request,
      options,
    ));
  }

  /**
   * Transcode subtitles
   *
   * @remarks
   * Only transcode subtitle streams.
   */
  async transcodeSubtitles(
    request: operations.TranscodeSubtitlesRequest,
    options?: RequestOptions,
  ): Promise<operations.TranscodeSubtitlesResponse> {
    return unwrapAsync(transcoderTranscodeSubtitles(
      this,
      request,
      options,
    ));
  }

  /**
   * Start A Transcoding Session
   *
   * @remarks
   * Starts the transcoder and returns the corresponding streaming resource document.
   */
  async startTranscodeSession(
    request: operations.StartTranscodeSessionRequest,
    options?: RequestOptions,
  ): Promise<operations.StartTranscodeSessionResponse> {
    return unwrapAsync(transcoderStartTranscodeSession(
      this,
      request,
      options,
    ));
  }
}
