
import React, { FunctionComponent } from 'react';
import { AnswerPbxCallButtonView } from './AnswerPbxCallButtonView';
import { IStyledProps } from '../../../../common/types';
import { TextStyle, ViewStyle } from 'react-native';
import { takeCall } from '../../../../../store/pbx/pbxSlice';
import { IPbxCall } from '../../../../../store/pbx/types';
import { useAppDispatch } from '../../../../../store/hooks';


interface IProps extends IStyledProps<{ icon?: TextStyle, container?: ViewStyle }> {
    call: IPbxCall
    iconCallName?: string
}

export const AnswerPbxCallButton: FunctionComponent<IProps> = ({ call, iconCallName, style }) => {
const dispatch = useAppDispatch();
    const AnswerAudioCall = () => {
        dispatch(takeCall(call.callId));
    };
    return <AnswerPbxCallButtonView onPress={AnswerAudioCall} callIconName={iconCallName} style={style} />;
};



