import {IBalloonContent, IUrlScheme} from '../redux';
import {Store} from '../stores/store';
import {MODALS} from './constants';

export class 
 {

    /**
     * @param {Object} balloon
     */
    public showBalloon(balloon: IBalloonContent): void {
        Store.dispatch({
            type: MODALS.SHOW_TRAY_BALLOON,
            data: balloon
        });
    }

    public toggleDevTools(): void {
        Store.dispatch({
            type: MODALS.TOGGLE_DEV_TOOLS
        });
    }

    public showUrlSchemeModal({url, disposition}: IUrlScheme): void {
        Store.dispatch({
            type: MODALS.SHOW_URL_SCHEME_MODAL,
            data: {
                bIsShowing: true,
                url: url,
                disposition: disposition
            },
            omitKeysFromLog: ['url']
        });
    }

    public hideUrlSchemeModal(): void {
        Store.dispatch({
            type: MODALS.HIDE_URL_SCHEME_MODAL,
            data: {
                bIsShowing: false,
                url: '',
                disposition: ''
            }
        });
    }
}

export default new ModalActions();
ModalActions