import { ClipCreationIntent } from '../types';
import updateClipCreationIntents from './updateClipCreationIntents';

/**
 * Creates a state updater function that updates a specific clip creation intent within tracks.
 * This is a common pattern used throughout the codebase to update a clip creation intent's properties.
 *
 * @param clipCreationIntentId The ID of the clip creation intent to update
 * @param updateFn A function that receives the current clip creation intent and returns the updated clip creation intent
 * @returns A function that can be used with setState to update the clip creation intent
 */

export default function updateClipCreationIntent(
  clipCreationIntentId: string,
  updateFn: (
    clipCreationIntent: ClipCreationIntent
  ) => ClipCreationIntent | null
) {
  return updateClipCreationIntents([clipCreationIntentId], updateFn);
}
