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 duplicateClips(
  clipIds: string[],
  updateFn: (clip: StudioClip) => StudioClip,
  trackIndexDelta: number = 0
) {
  return updateClips(clipIds, updateFn, trackIndexDelta, true);
}
