
import React, { FunctionComponent } from 'react';
import { HoldCallButtonView } from './HoldCallButtonView';
import { IStyledProps } from '../../../../common/types';
import { TextStyle, } from 'react-native';
import { holdCall } from '../../../../../store/pbx/pbxSlice';
import { IPbxCall } from '../../../../../store/pbx/types';
import { useAppDispatch } from '../../../../../store/hooks';
interface IProps extends IStyledProps<{ icon?: TextStyle }> {
    call: IPbxCall
    iconCallName?: string
}
const dispatch = useAppDispatch();

export const HoldCallButton: FunctionComponent<IProps> = ({ call, iconCallName, style }) => {

    const onHoldCall = () => {
        dispatch(holdCall(call.callId));
    };
    return <HoldCallButtonView onPress={onHoldCall} callIconName={iconCallName} style={style} call={call} />;
};