import { ForwardRefExoticComponent, Context } from 'rax';
import Form, { FormProps } from './form';
import SubHeader, { SubHeaderProps } from './sub-header';
import Content, { FormContentProps } from './content';
import Item, { FormItemContext, FormItemProps, FormItemContextProps } from './item';
import Footer, { FormFooterProps } from './footer';
import FormContext, { FormContextProps } from './context';

export interface FormComponent extends ForwardRefExoticComponent<FormProps> {
  SubHeader?: ForwardRefExoticComponent<SubHeaderProps>;
  Content?: ForwardRefExoticComponent<FormContentProps>;
  Item?: ForwardRefExoticComponent<FormItemProps>;
  Footer?: ForwardRefExoticComponent<FormFooterProps>;
  Context?: Context<FormContextProps>;
  ItemContext?: Context<FormItemContextProps>;
}

const ExpandForm: FormComponent = Form;
ExpandForm.SubHeader = SubHeader;
ExpandForm.Content = Content;
ExpandForm.Item = Item;
ExpandForm.Footer = Footer;
ExpandForm.Context = FormContext;
ExpandForm.ItemContext = FormItemContext;

export {
  Form,
  SubHeader,
  Content,
  Item,
  Footer,
  FormProps,
  SubHeaderProps,
  FormContentProps,
  FormItemProps,
  FormFooterProps,
};

export default ExpandForm;
