import React, { Component } from 'react';
import type { ViewProps } from 'react-native';

import { RtcVideoView } from './common/tx_video_view_native';

export interface TXRemoteViewProps {
  userId: string;
  viewType?: number;
  streamType: number;
  mirror?: boolean;
  renderParams?: {
    rotation?: number;
    fillMode?: number;
    mirrorType?: number;
  };
}

export interface TXLocalViewProps {
  viewType?: number;
  mirror?: boolean;
  frontCamera?: boolean;
  renderParams?: {
    rotation?: number;
    fillMode?: number;
    mirrorType?: number;
  };
}

/**
 * Local video rendering device, no user ID is required
 */
class LocalView extends Component<ViewProps & TXLocalViewProps, {}> {
  render() {
    return <RtcVideoView {...this.props} userId="" streamType={0} />;
  }
}

/**
 * The remote video rendering device needs to pass the user ID
 */
class RemoteView extends Component<ViewProps & TXRemoteViewProps, {}> {
  render() {
    return <RtcVideoView {...this.props} />;
  }
}

export default {
  LocalView,
  RemoteView,
};
