// Fixture builders for TrackRef. Use in test setup to avoid
// re-declaring the same literal across 18+ files.

import type { TrackRef } from '$lib/api/types';

export function makeTrack(overrides: Partial<TrackRef> = {}): TrackRef {
  return {
    id: 't1',
    title: 'Test Track',
    album_id: 'a1',
    album_title: 'Test Album',
    artist_id: 'ar1',
    artist_name: 'Test Artist',
    track_number: 1,
    disc_number: 1,
    duration_sec: 180,
    stream_url: '/api/tracks/t1/stream',
    ...overrides
  };
}

export function makeTracks(n: number, overrides: Partial<TrackRef> = {}): TrackRef[] {
  return Array.from({ length: n }, (_, i) =>
    makeTrack({
      id: `t${i + 1}`,
      title: `Test Track ${i + 1}`,
      stream_url: `/api/tracks/t${i + 1}/stream`,
      ...overrides
    })
  );
}
