import type { StreamKind } from '@pulse/shared';

export type TDevices = {
  input: {
    deviceId: string | undefined;
    autoGainControl: boolean;
    echoCancellation: boolean;
    noiseSuppression: boolean;
    noiseSuppressionEnhanced: boolean;
    noiseSuppressionRnnoise: boolean;
    noiseSuppressionDeepFilterNet: boolean;
    keyboardSuppression: boolean;
    voiceSensitivity: number;
  };
  playback: {
    deviceId: string | undefined;
  };
  webcam: {
    deviceId: string | undefined;
    resolution: Resolution;
    framerate: number;
  };
  screen: {
    resolution: Resolution;
    framerate: number;
    audio: boolean;
  };
};

export enum Resolution {
  '2160p' = '2160p',
  '1440p' = '1440p',
  '1080p' = '1080p',
  '720p' = '720p',
  '480p' = '480p',
  '360p' = '360p',
  '240p' = '240p',
  '144p' = '144p'
}

export type TDeviceSettings = {
  microphoneId: string | undefined;
  playbackId: string | undefined;
  webcamId: string | undefined;
  webcamResolution: Resolution;
  webcamFramerate: number;
  echoCancellation: boolean;
  noiseSuppression: boolean;
  noiseSuppressionEnhanced: boolean;
  noiseSuppressionRnnoise: boolean;
  noiseSuppressionDeepFilterNet: boolean;
  keyboardSuppression: boolean;
  voiceSensitivity: number;
  autoGainControl: boolean;
  shareSystemAudio: boolean;
  screenResolution: Resolution;
  screenFramerate: number;
  screenAudioBitrate: number;
};

export type TRemoteUserStreamKinds =
  | StreamKind.AUDIO
  | StreamKind.VIDEO
  | StreamKind.SCREEN
  | StreamKind.SCREEN_AUDIO;

export type TRemoteStreams = {
  [userId: number]: {
    [StreamKind.AUDIO]: MediaStream | undefined;
    [StreamKind.VIDEO]: MediaStream | undefined;
    [StreamKind.SCREEN]: MediaStream | undefined;
    [StreamKind.SCREEN_AUDIO]: MediaStream | undefined;
  };
};
