import { describe, it, expect } from 'vitest';
import type {
  TrackListDisplayMode,
  TrackSortOption,
  SortOrder,
  TrackFilterOptions,
  TrackSortOptions,
  TrackListBaseProps,
  TrackListState,
} from './types';

describe('Track List Types', () => {
  it('should have correct TrackListDisplayMode type', () => {
    const modes: TrackListDisplayMode[] = ['list', 'grid'];
    expect(modes).toContain('list');
    expect(modes).toContain('grid');
  });

  it('should have correct TrackSortOption type', () => {
    const options: TrackSortOption[] = [
      'title',
      'artist',
      'album',
      'duration',
      'date',
      'popularity',
    ];
    expect(options).toContain('title');
    expect(options).toContain('artist');
    expect(options).toContain('album');
    expect(options).toContain('duration');
    expect(options).toContain('date');
    expect(options).toContain('popularity');
  });

  it('should have correct SortOrder type', () => {
    const orders: SortOrder[] = ['asc', 'desc'];
    expect(orders).toContain('asc');
    expect(orders).toContain('desc');
  });

  it('should have correct TrackFilterOptions interface', () => {
    const filterOptions: TrackFilterOptions = {
      genre: 'Rock',
      artist: 'Artist Name',
      album: 'Album Name',
      year: 2023,
      minDuration: 60,
      maxDuration: 300,
    };

    expect(filterOptions.genre).toBe('Rock');
    expect(filterOptions.artist).toBe('Artist Name');
    expect(filterOptions.album).toBe('Album Name');
    expect(filterOptions.year).toBe(2023);
    expect(filterOptions.minDuration).toBe(60);
    expect(filterOptions.maxDuration).toBe(300);
  });

  it('should have correct TrackSortOptions interface', () => {
    const sortOptions: TrackSortOptions = {
      field: 'title',
      order: 'asc',
    };

    expect(sortOptions.field).toBe('title');
    expect(sortOptions.order).toBe('asc');
  });

  it('should have correct TrackListBaseProps interface', () => {
    const baseProps: TrackListBaseProps = {
      tracks: [],
      onTrackClick: () => {},
      onTrackPlay: () => {},
      className: 'custom-class',
    };

    expect(baseProps.tracks).toEqual([]);
    expect(typeof baseProps.onTrackClick).toBe('function');
    expect(typeof baseProps.onTrackPlay).toBe('function');
    expect(baseProps.className).toBe('custom-class');
  });

  it('should have correct TrackListState interface', () => {
    const state: TrackListState = {
      tracks: [],
      filteredTracks: [],
      displayMode: 'list',
      sortOptions: { field: 'title', order: 'asc' },
      filterOptions: {},
      isLoading: false,
      error: null,
    };

    expect(state.tracks).toEqual([]);
    expect(state.filteredTracks).toEqual([]);
    expect(state.displayMode).toBe('list');
    expect(state.sortOptions.field).toBe('title');
    expect(state.sortOptions.order).toBe('asc');
    expect(state.filterOptions).toEqual({});
    expect(state.isLoading).toBe(false);
    expect(state.error).toBeNull();
  });
});
