import type { Dispatch, SetStateAction, JSX } from "react";

export enum AnimationStateEnum {
  unmounted = "unmounted",
  hidden = "hidden",
  visible = "visible",
}

export type AnimationState = keyof typeof AnimationStateEnum

export type ModalProps = {
  onAnimationComplete?: () => void
  title?: string
  subtitle?: string
  withActions?: boolean
  hideHeader?: boolean
  className?: string
} & (
  | { trigger: JSX.Element; isOpen?: never; onToggle?: never }
  | {
      trigger?: never
      isOpen: boolean
      onToggle: (open: boolean) => void
    }
)

export type InnerModalProps = Omit<ModalProps, "trigger"> & {
  animation: AnimationState
  setAnimation: Dispatch<SetStateAction<AnimationState>>
}
