/**
 * @file containers/AppBar.tsx
 * Container for the AppBar component
 *
 * Created by Jack LightFoot on 08/22/2017
 *
 * T2 PWA Starter
 *
 * Copyright © 2009-2017 United States Government as represented by
 * the Chief Information Officer of the National Center for Telehealth
 * and Technology. All Rights Reserved.
 *
 * Copyright © 2009-2017 Contributors. All Rights Reserved.
 *
 * THIS OPEN SOURCE AGREEMENT ("AGREEMENT") DEFINES THE RIGHTS OF USE,
 * REPRODUCTION, DISTRIBUTION, MODIFICATION AND REDISTRIBUTION OF CERTAIN
 * COMPUTER SOFTWARE ORIGINALLY RELEASED BY THE UNITED STATES GOVERNMENT
 * AS REPRESENTED BY THE GOVERNMENT AGENCY LISTED BELOW ("GOVERNMENT AGENCY").
 * THE UNITED STATES GOVERNMENT, AS REPRESENTED BY GOVERNMENT AGENCY, IS AN
 * INTENDED THIRD-PARTY BENEFICIARY OF ALL SUBSEQUENT DISTRIBUTIONS OR
 * REDISTRIBUTIONS OF THE SUBJECT SOFTWARE. ANYONE WHO USES, REPRODUCES,
 * DISTRIBUTES, MODIFIES OR REDISTRIBUTES THE SUBJECT SOFTWARE, AS DEFINED
 * HEREIN, OR ANY PART THEREOF, IS, BY THAT ACTION, ACCEPTING IN FULL THE
 * RESPONSIBILITIES AND OBLIGATIONS CONTAINED IN THIS AGREEMENT.
 *
 * Government Agency: The National Center for Telehealth and Technology
 * User Registration Requested. Please send email
 * with your contact information to: robert.a.kayl.civ@mail.mil
 * Government Agency Point of Contact for
 * Original Software: robert.a.kayl.civ@mail.mil
 */
import {connect} from 'react-redux';
import AppBarComponent from '../components/AppBar';

interface OwnPropsInterface{
  leftIcon: any;
  rightIcon: any;
  defaultTitle?: string;
  onTitleClick?: any;
}

interface StatePropsInterface{
  title: string;
  rightIcon: JSX.Element;
  leftIcon: JSX.Element;
}

interface DispPropsInterface{ // just testing ts and doesn't seem to work
const stateToProps = (state,ownProps:OwnPropsInterface) => {
  return {
    title: state.view.page.title || ownProps.defaultTitle,
    leftIcon: ownProps.leftIcon,
    rightIcon: ownProps.rightIcon
  }
}
const dispatchToProps = (dispatch,ownProps) => {
  return {
  }
}
/**
 * Trying to get typessafe containers using connect. This is as close as I can get for now
 * @see https://spin.atomicobject.com/2017/04/20/typesafe-container-components/
 * @see https://stackoverflow.com/questions/40671978/typescript-struggles-with-redux-containers
 */

export default connect<StatePropsInterface,DispPropsInterface,OwnPropsInterface>(stateToProps,dispatchToProps)(AppBarComponent);
}

