import { CallingState } from '@stream-io/video-react-sdk';
import { keyframes } from '@material-hu/mui/styles';

import { type CallError, ResponseErrorCodes } from 'src/types/stream';

export const MAX_CALL_PARTICIPANTS = 32;

// created to avoid the snackbar to be on top of the button
export const CALL_SNACKBAR_BOTTOM_SPACING = 74;

export const CALL_INVITE_PARTICIPANTS_TIMEOUT = 60000;

export const SPEAKING_THRESHOLD_MS = 3000;

export const BROADCAST_CHANNEL_EVENTS = {
  FOCUS_REQUEST: 'FOCUS_REQUEST',
  FOCUS_ACK: 'FOCUS_ACK',
} as const;

export const CALL_ERROR_HEADER_KEYS: Record<CallError, string> = {
  [ResponseErrorCodes.CALL_INVALID_STATUS]: 'call_finished_header',
  [ResponseErrorCodes.CALL_TOO_MANY_PARTICIPANTS]: 'lobby_header',
  [ResponseErrorCodes.FINISHED_CALL]: 'call_finished_header',
  [CallingState.LEFT]: 'call_left_header',
};

export const SPEAKER_INDICATOR_FADE_IN = keyframes`
  from { opacity: 0; }
  to { opacity: 1; }
`;
