import { describe, it, expect } from 'vitest';
import type { Track, PlayerState, PlayerControls } from './types';

describe('Player Types', () => {
  describe('Track', () => {
    it('should have required properties', () => {
      const track: Track = {
        id: 1,
        title: 'Test Track',
        duration: 180,
        url: 'https://example.com/track.mp3',
      };

      expect(track.id).toBe(1);
      expect(track.title).toBe('Test Track');
      expect(track.duration).toBe(180);
      expect(track.url).toBe('https://example.com/track.mp3');
    });

    it('should support optional properties', () => {
      const track: Track = {
        id: 1,
        title: 'Test Track',
        duration: 180,
        url: 'https://example.com/track.mp3',
        artist: 'Test Artist',
        album: 'Test Album',
        cover: 'https://example.com/cover.jpg',
        genre: 'Rock',
      };

      expect(track.artist).toBe('Test Artist');
      expect(track.album).toBe('Test Album');
      expect(track.cover).toBe('https://example.com/cover.jpg');
      expect(track.genre).toBe('Rock');
    });
  });

  describe('PlayerState', () => {
    it('should have all required properties', () => {
      const state: PlayerState = {
        currentTrack: null,
        isPlaying: false,
        currentTime: 0,
        duration: 0,
        volume: 100,
        muted: false,
        queue: [],
        currentIndex: -1,
        repeat: 'off',
        shuffle: false,
      };

      expect(state.currentTrack).toBeNull();
      expect(state.isPlaying).toBe(false);
      expect(state.currentTime).toBe(0);
      expect(state.duration).toBe(0);
      expect(state.volume).toBe(100);
      expect(state.muted).toBe(false);
      expect(state.queue).toEqual([]);
      expect(state.currentIndex).toBe(-1);
      expect(state.repeat).toBe('off');
      expect(state.shuffle).toBe(false);
    });
  });

  describe('PlayerControls', () => {
    it('should have all required methods', () => {
      const controls: PlayerControls = {
        play: () => {},
        pause: () => {},
        resume: () => {},
        stop: () => {},
        next: () => {},
        previous: () => {},
        seek: () => {},
        setVolume: () => {},
        toggleMute: () => {},
        toggleShuffle: () => {},
        setRepeat: () => {},
        addToQueue: () => {},
        clearQueue: () => {},
      };

      expect(typeof controls.play).toBe('function');
      expect(typeof controls.pause).toBe('function');
      expect(typeof controls.resume).toBe('function');
      expect(typeof controls.stop).toBe('function');
      expect(typeof controls.next).toBe('function');
      expect(typeof controls.previous).toBe('function');
      expect(typeof controls.seek).toBe('function');
      expect(typeof controls.setVolume).toBe('function');
      expect(typeof controls.toggleMute).toBe('function');
      expect(typeof controls.toggleShuffle).toBe('function');
      expect(typeof controls.setRepeat).toBe('function');
      expect(typeof controls.addToQueue).toBe('function');
      expect(typeof controls.clearQueue).toBe('function');
    });
  });
});
