<?php

declare(strict_types=1);

namespace App\Domain\PreSave\ValueObjects;

/**
 * Streaming Platform Enum
 *
 * Supported platforms for pre-save campaigns
 */
enum StreamingPlatform: string
{
    case SPOTIFY = 'spotify';
    case TIDAL = 'tidal';
    case APPLE_MUSIC = 'apple_music';
    case DEEZER = 'deezer';
    case YOUTUBE_MUSIC = 'youtube_music';

    /**
     * Get display name
     */
    public function getDisplayName(): string
    {
        return match ($this) {
            self::SPOTIFY => 'Spotify',
            self::TIDAL => 'Tidal',
            self::APPLE_MUSIC => 'Apple Music',
            self::DEEZER => 'Deezer',
            self::YOUTUBE_MUSIC => 'YouTube Music',
        };
    }

    /**
     * Get OAuth provider name (matches OAuthService providers)
     */
    public function getOAuthProvider(): string
    {
        return $this->value;
    }

    /**
     * Check if platform is currently supported
     */
    public function isSupported(): bool
    {
        return match ($this) {
            self::SPOTIFY => true,
            self::TIDAL => false, // TODO: Implement
            self::APPLE_MUSIC => false, // TODO: Implement
            self::DEEZER => false, // TODO: Implement
            self::YOUTUBE_MUSIC => false, // TODO: Implement
        };
    }

    /**
     * Get all supported platforms
     *
     * @return array<self>
     */
    public static function supported(): array
    {
        return array_filter(
            self::cases(),
            fn (self $platform) => $platform->isSupported()
        );
    }
}
