import { StudioClip } from '../types';
import updateClips from './updateClips';

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

export default function updateClip(
  clipId: string,
  updateFn: (clip: StudioClip) => StudioClip
) {
  return updateClips([clipId], updateFn);
}
