// @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';
import type { AriaProps } from '../../../mixins/aria';

export type SegmentedControlProps = {|
  ...TestingProps,
  ...MarginOnlySpaceProps,
  ...StackeeProps,
  ...AriaProps,
  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: () => {},
  },
);
