package com.castlabs.reactnative.errors;

public enum ErrorCode {
  /* Errors from the network stack, range between 1000-1999. */

  /**
   * This error is raised if an exception occurred while downloading playback data.
   */
  MEDIA_DOWNLOADING_FAILED(1000),

  /**
   * This error is raised if a DRM key could not be fetched successfully.
   * This is usually caused when offline licenses are loaded.
   */
  DRM_KEY_DOWNLOADING_FAILED(1001),

  /**
   * This error is raised if an exception occurred while downloading playback
   * and no network connectivity is available.
   */
  CONNECTIVITY_LOST(1003),

  /**
   * This exception is raised after the player
   * lost connectivity (ConnectivityLost), once connectivity was re-gained.
   */
  CONNECTIVITY_GAINED(1004),

  /**
   * This error is raised if an exception occurred while downloading data.
   */
  DATA_DOWNLOADING_FAILED(1005),

  /**
   * This error is raised when a DNS server error occurs.
   */
  DNS_LOOKUP_FAILED(1006),

  /**
   * This error is raised when a timeout error occurs.
   */
  TIMEOUT_OCCURRED(1007),

  /* Errors parsing and processing text streams, range between 2000-2999. */

  /**
   * This error is raised if all text tracks are filtered out as unsupported.
   */
  TEXT_UNSUPPORTED(2001),

  // Used by other platforms
  TEXT_TRACK_ALREADY_LOADED(2003),

  /* Errors parsing or processing audio or video streams, range between 3000-3999. */

  /**
   * Raised when the player reports a general playback error.
   */
  MEDIA_ERROR(3001),

  /**
   * Error raised when the audio track can not be initialized.
   */
  AUDIO_TRACK_INITIALIZATION_FAILED(3002),

  /**
   * Error raised when the audio decoder can not be initialized.
   */
  AUDIO_DECODER_INITIALIZATION_FAILED(3003),

  /**
   * Raised when an error occurs while writing to the audio track.
   */
  AUDIO_WRITE_ERROR(3004),

  /**
   * Raised when the video decoder can not be initialized.
   */
  VIDEO_DECODER_INITIALIZATION(3005),

  /**
   * This error is raised if all audio tracks are filtered out as unsupported.
   */
  AUDIO_UNSUPPORTED(3006),

  /**
   * This error is raised if all video tracks are filtered out as unsupported.
   */
  VIDEO_UNSUPPORTED(3007),

  /**
   * Error raised when the applied filters were not able to find any viable
   * content that can be displayed on the current device.
   */
  NO_PLAYABLE_CONTENT(3008),

  /* Errors parsing the Manifest, range between 4000-4999. */

  /**
   * This error type is raised when loading
   * the player manifest (i.e. the DASH mpd, or the HLS playlist) failed.
   */
  MANIFEST_LOADING_FAILED(4001),

  /**
   * This error type is raised when parsing
   * the player manifest (i.e. the DASH mpd, or the HLS playlist) failed.
   */
  MANIFEST_PARSING_FAILED(4002),

  /**
   * This error happens when the player found a semantic issue with a Manifest.
   * This could be due to a change in between manifest updates deemed
   * as illegal by the corresponding spec.
   */
  MANIFEST_INVALID(4003),

  /* Errors related to streaming, range between 5000-5999. */

  /**
   * Error raised when the current playback position is behind the live edge
   * in a live stream.
   */
  BEHIND_LIVE_WINDOW(5001),

  // For reference purposes, used by other platforms
  STREAM_LOADING_FAILED(5002),

  /* Errors related to DRM, range between 6000-6999. */

  /**
   * This error is raised if an exception occurred while the player was
   * communicating with DRM server to fetch a license.
   * <p>
   * Note that this error usually occurs during license acquisition and
   * before any decryption errors are reported by the decoder.
   */
  DRM_ERROR(6001),

  /**
   * Error raised during device provisioning.
   */
  DRM_PROVISIONING_FAILED(6002),

  /**
   * This error is raised if an exception occurred while the player was
   * communicating with DRMToday to fetch a license.
   */
  DRMTODAY_ERROR(6003),

  /**
   * Raised when an error occurs while decrypting audio data.
   */
  AUDIO_DECRYPTION_FAILED(6004),

  /**
   * Raised when an error occurs while decrypting video data.
   */
  VIDEO_DECRYPTION_FAILED(6005),

  /**
   * This error is raised if you are trying to use a DRM system
   * that is not supported by the device.
   */
  DRM_UNSUPPORTED(6006),

  /**
   * This error is raised if a secondary display is detected and the current
   * configuration does not permit playback on that display.
   */
  SECONDARY_DISPLAY_FORBIDDEN(6007),

  /**
   * This error is raised if a DRM key expires during playback.
   */
  KEY_EXPIRED(6008),

  /**
   * This exception is raised after the player sees changes in HDCP connectivity.
   */
  HDCP_CONNECTION_WARNING(6009),

  /**
   * Error raised when concurrent stream limiting reaches maximum clients.
   */
  CSL_LIMIT_REACHED(6010),

  /**
   * Error raised when there's a network error with the concurrent stream
   * limiting service.
   */
  CSL_NETWORK_ERROR(6011),

  /* Miscellaneous errors from the player, range between 7000-7999. */

  /**
   * General player error.
   */
  PLAYER_ERROR(7001),

  /**
   * Error raised when no plugin was found that can be used to create a renderer
   * to playback a given DRM and content combination.
   */
  NO_RENDERER_FOUND(7005),

  /**
   * Raised when the player configuration is invalid.
   */
  INVALID_CONFIGURATION(7013),

  PLAYER_NOT_FOUND(7014),

  // For reference purposes, used by other platforms
  COMPLETER_NOT_FOUND(7015),

  /* Errors related to cast, range between 8000-8999. */

  /* Errors related to plugins, range between 9000-9999. */

  // For reference purposes, used by other platforms
  THUMBNAILS_CONTENT_INVALID(9001),

  // For reference purposes, used by other platforms
  THUMBNAILS_IMAGE_MISSING(9002),

  /**
   * Error raised when the userID is mandatory and has not been provided.
   */
  // Android:
  // - TYPE_USER_ID_NOT_PROVIDED (SEVERITY_ERROR)
  USER_ID_NOT_PROVIDED(9003),

  /* Errors related to ads, range between 10000-10999. */

  /**
   * This error is raised when a general error occurs at initializing or during an Ad.
   */
  AD_ERROR(10001),

  /**
   * Error raised when trying to play Ads but the current Player setup doesn't support it.
   */
  AD_REQUEST_UNSUPPORTED(10002),

  /* Errors related to storage, range between 11000-11999. */

  // For reference purposes, used by other platforms
  STORAGE_REMOVING_FAILED(11001),

  // For reference purposes, used by other platforms
  STORAGE_READING_FAILED(11002),

  // For reference purposes, used by other platforms
  STORAGE_WRITING_FAILED(11003),

  /* Errors related to SDK, range between 12000-12999. */

  /**
   * Error raised when the SDK could not be initialized successfully.
   */
  SDK_INITIALIZATION_FAILED(12001),

  /**
   * Error raised when the SDK was not initialized before calling a method.
   */
  SDK_NOT_INITIALIZED(12002),

  /**
   * Error raised when the Castlabs player license is invalid or expired.
   */
  SDK_INVALID_LICENCE(12003),

  /**
   * This error is raised if a method is called that is not supported on the current API level.
   */
  PLATFORM_API_MISMATCH(12004),

  /* Errors related to Download Plugin, range between 13000-13999. */

  DOWNLOAD_ID_ALREADY_IN_USE(13001),
  DOWNLOAD_NOT_FOUND(13002),
  DOWNLOAD_FAILED(13003);

  public final int value;

  ErrorCode(int value) {
    this.value = value;
  }
}
