interface FocusableTimeProps {
  isActive: (time: number) => boolean;
  isNow: (time: number) => boolean;
  isDisabled: (time: number) => boolean;
  timeSpan: readonly number[];
}

export function getFocusableTime(props: FocusableTimeProps): number | undefined {
  return (
    props.timeSpan.find((time: number) => props.isActive(time)) ||
    props.timeSpan.find((time: number) => props.isNow(time) && !props.isDisabled(time)) ||
    props.timeSpan.find((time: number) => !props.isDisabled(time))
  );
}
