import { ExactBeatRange } from '../types';

export default function validateContextWindow(
  selection: ExactBeatRange,
  contextWindow: ExactBeatRange
) {
  if (contextWindow.startBeats > selection.startBeats) {
    console.error({ contextWindow, selection });
    throw new Error('Context window starts after selection');
  }

  if (contextWindow.endBeats < selection.endBeats) {
    console.error({ contextWindow, selection });
    throw new Error('Context window ends before selection');
  }

  return true;
}
