/// Auto-generated with ScanbotSDKCodegenV3. Modifications will be overwritten.
/// Generated from xplatforms/schemas/barcode_scanner/SdkConfiguration.yaml

import { DeepPartial } from '../core/utils/utils';

/**
Initialize configuration for the Scanbot SDK.
*/
export class SdkConfiguration {
  /**
    Your license key for the Scanbot SDK. See the "License Key" section below.
    */
  public licenseKey: string;
  /**
    Optional boolean flag to enable logging. See the "Logging" section below.
    
    Default is false
    */
  public loggingEnabled: boolean = false;
  /**
    Optional boolean flag that enables Scanbot SDK Core native logging (default is false, Android only).
    
    Default is false
    */
  public enableNativeLogging: boolean = false;
  /**
    Optional directory as file URI to override the default storage base directory of the Scanbot SDK. Refer to the section "Storage" for more details.
    */
  public storageBaseDirectory: string | null = null;
  /**
    Optional file encryption mode, 'AES128' or 'AES256'.
    */
  public fileEncryptionMode: FileEncryptionMode | null = null;
  /**
    Optional file encryption password. Refer to the section "Storage Encryption" for more details.
    */
  public fileEncryptionPassword: string | null = null;
  /**
    If set to `true`, PerformanceHintApi is enabled, which lead to increase of performance due of increased use of top CPU cores (Android only), also increase battery usage.
    
    Default is true
    */
  public performanceHintApi: boolean = true;
  /**
    If set to `true`, GPU Acceleration will be enabled for Barcode Scanner, Document Scanner and Generic Document Recognizer (Android only).
    
    Default is true
    */
  public allowGpuAcceleration: boolean = true;
  /**
    Enables/disables XNNPACK acceleration for TensorFlow ML models, which provides highly optimized implementations of floating-point neural network operators (Android only).
    
    Default is true
    */
  public allowXnnpackAcceleration: boolean = true;

  /** @param source {@displayType `DeepPartial<SdkConfiguration>`} */
  public constructor(source: DeepPartial<SdkConfiguration> = {}) {
    if (source.licenseKey !== undefined) {
      this.licenseKey = source.licenseKey;
    } else {
      throw new Error('licenseKey must be present in constructor argument');
    }
    if (source.loggingEnabled !== undefined) {
      this.loggingEnabled = source.loggingEnabled;
    }
    if (source.enableNativeLogging !== undefined) {
      this.enableNativeLogging = source.enableNativeLogging;
    }
    if (source.storageBaseDirectory !== undefined) {
      this.storageBaseDirectory =
        source.storageBaseDirectory != null ? source.storageBaseDirectory : null;
    }
    if (source.fileEncryptionMode !== undefined) {
      this.fileEncryptionMode =
        source.fileEncryptionMode != null
          ? FileEncryptionModeValues.includes(source.fileEncryptionMode)
            ? source.fileEncryptionMode
            : null
          : null;
    }
    if (source.fileEncryptionPassword !== undefined) {
      this.fileEncryptionPassword =
        source.fileEncryptionPassword != null ? source.fileEncryptionPassword : null;
    }
    if (source.performanceHintApi !== undefined) {
      this.performanceHintApi = source.performanceHintApi;
    }
    if (source.allowGpuAcceleration !== undefined) {
      this.allowGpuAcceleration = source.allowGpuAcceleration;
    }
    if (source.allowXnnpackAcceleration !== undefined) {
      this.allowXnnpackAcceleration = source.allowXnnpackAcceleration;
    }
  }
}

/**
File encryption mode.

- `AES128`:
   AES 128-bit encryption.
- `AES256`:
   AES 256-bit encryption.
*/
export type FileEncryptionMode =
  /**
    AES 128-bit encryption.
    */
  | 'AES128'
  /**
    AES 256-bit encryption.
    */
  | 'AES256';

/** @hidden */
export const FileEncryptionModeValues: ReadonlyArray<FileEncryptionMode> = [
  'AES128',
  'AES256',
] as const;
