
import React, { FunctionComponent } from 'react';
import { IStyledProps } from '../../../../common/types';
import { TextStyle } from 'react-native';
import { TransferCallButtonView } from './TransferCallButtonView';
import { pbxService } from '../../../../../services/calls/pbx';
import { IPbxCall } from '../../../../../store/pbx/types';
import { useAppDispatch, useAppSelector } from '../../../../../store/hooks';
interface IProps extends IStyledProps<{ icon?: TextStyle }> {
    call: IPbxCall
    iconCallName?: string
}
export const TransferCallButton: FunctionComponent<IProps> = ({ call, iconCallName, style,  }) => {
    const dispatch = useAppDispatch();
    const secondCall = useAppSelector((state) => state.pbx.secondCall);
    const onTransferCall = () => {
        pbxService.TransferCall(
            call!.callId,
            secondCall!.callReferenceId
        );
    };
    return <TransferCallButtonView onPress={onTransferCall} callIconName={iconCallName} style={style} call={call} />;
};
