import React, { ReactElement } from 'react';
import {
  LifecyclePhase,
} from '@workbench-stack/core';
import { LifecycleCommonComponent } from '@adminide-stack/platform-client';

export type WithFalse<T> = T | false;

export interface LifecycleProps {
  setPhaseReady?: boolean;
  setPhase?: LifecyclePhase;
  renderWhenPhase?: LifecyclePhase;
  loadingRenderer: ({ loading }: {
    loading: boolean;
  }) => ReactElement;
  children?: ReactElement
}

export const Lifecycle = ({ children, ...rest }: LifecycleProps) => {
  return <LifecycleCommonComponent {...rest} >
    {children}
  </LifecycleCommonComponent>
};