import { StudioTrack } from '../types';
import updateTracks from './updateTracks';

/**
 * Creates a state updater function that updates a specific track within the project state.
 * This is a common pattern used throughout the codebase to update a track's properties.
 *
 * @param trackId The ID of the track to update
 * @param updateFn A function that receives the current track and returns the updated track
 * @returns A function that can be used with setState to update the track
 */
export default function updateTrack(
  trackId: string,
  updateFn: (track: StudioTrack) => StudioTrack
) {
  return updateTracks([trackId], updateFn);
}
