// @flow
import React, { type Element } from 'react';
import type { MarginOnlySpaceProps } from '../../../mixins/spacing';
import type { StackeeProps } from '../../../mixins/stackee';
import type { TestingProps } from '../../../mixins/testing';

export type SegmentedControlProps = {|
  ...TestingProps,
  ...MarginOnlySpaceProps,
  ...StackeeProps,
  value: string | number,
  onChange: (string | number) => void,
  children: Array<Element<*>>,
|};

export type SegmentedControlContextValue = {|
  selectedValue: string | number,
  onItemClick: (string | number) => void,
|};

export const SegmentedControlContext = React.createContext<SegmentedControlContextValue>(
  {
    selectedValue: 0,
    onItemClick: () => {},
  },
);
