<?php

declare(strict_types=1);

namespace App\Domain\SmartLink\Enums;

enum ServiceType: string
{
    // Music Streaming
    case SPOTIFY = 'spotify';
    case APPLE_MUSIC = 'apple_music';
    case YOUTUBE_MUSIC = 'youtube_music';
    case DEEZER = 'deezer';
    case TIDAL = 'tidal';
    case AMAZON_MUSIC = 'amazon_music';
    case SOUNDCLOUD = 'soundcloud';

    // Video
    case YOUTUBE = 'youtube';
    case VIMEO = 'vimeo';

    // Social Media
    case INSTAGRAM = 'instagram';
    case TIKTOK = 'tiktok';
    case FACEBOOK = 'facebook';
    case TWITTER = 'twitter';

    // E-Commerce
    case BANDCAMP = 'bandcamp';
    case SHOPIFY = 'shopify';

    // Ticketing
    case EVENTBRITE = 'eventbrite';
    case TICKETMASTER = 'ticketmaster';

    // Generic
    case WEBSITE = 'website';
    case CUSTOM = 'custom';

    public function getLabel(): string
    {
        return match ($this) {
            self::SPOTIFY => 'Spotify',
            self::APPLE_MUSIC => 'Apple Music',
            self::YOUTUBE_MUSIC => 'YouTube Music',
            self::DEEZER => 'Deezer',
            self::TIDAL => 'Tidal',
            self::AMAZON_MUSIC => 'Amazon Music',
            self::SOUNDCLOUD => 'SoundCloud',
            self::YOUTUBE => 'YouTube',
            self::VIMEO => 'Vimeo',
            self::INSTAGRAM => 'Instagram',
            self::TIKTOK => 'TikTok',
            self::FACEBOOK => 'Facebook',
            self::TWITTER => 'Twitter',
            self::BANDCAMP => 'Bandcamp',
            self::SHOPIFY => 'Shopify',
            self::EVENTBRITE => 'Eventbrite',
            self::TICKETMASTER => 'Ticketmaster',
            self::WEBSITE => 'Website',
            self::CUSTOM => 'Custom Link',
        };
    }

    public function getCategory(): ServiceCategory
    {
        return match ($this) {
            self::SPOTIFY, self::APPLE_MUSIC, self::YOUTUBE_MUSIC, self::DEEZER,
            self::TIDAL, self::AMAZON_MUSIC, self::SOUNDCLOUD => ServiceCategory::MUSIC_STREAMING,

            self::YOUTUBE, self::VIMEO => ServiceCategory::VIDEO,

            self::INSTAGRAM, self::TIKTOK, self::FACEBOOK, self::TWITTER => ServiceCategory::SOCIAL_MEDIA,

            self::BANDCAMP, self::SHOPIFY => ServiceCategory::ECOMMERCE,

            self::EVENTBRITE, self::TICKETMASTER => ServiceCategory::TICKETING,

            self::WEBSITE, self::CUSTOM => ServiceCategory::CUSTOM,
        };
    }

    public function getIconClass(): string
    {
        return match ($this) {
            self::SPOTIFY => 'icon-spotify',
            self::APPLE_MUSIC => 'icon-apple',
            self::YOUTUBE, self::YOUTUBE_MUSIC => 'icon-youtube',
            self::DEEZER => 'icon-deezer',
            self::TIDAL => 'icon-tidal',
            self::AMAZON_MUSIC => 'icon-amazon',
            self::SOUNDCLOUD => 'icon-soundcloud',
            self::VIMEO => 'icon-vimeo',
            self::INSTAGRAM => 'icon-instagram',
            self::TIKTOK => 'icon-tiktok',
            self::FACEBOOK => 'icon-facebook',
            self::TWITTER => 'icon-twitter',
            self::BANDCAMP => 'icon-bandcamp',
            self::SHOPIFY => 'icon-shopify',
            self::EVENTBRITE => 'icon-eventbrite',
            self::TICKETMASTER => 'icon-ticketmaster',
            self::WEBSITE => 'icon-globe',
            self::CUSTOM => 'icon-link',
        };
    }

    public function supportsPreSave(): bool
    {
        return match ($this) {
            self::SPOTIFY, self::APPLE_MUSIC, self::DEEZER => true,
            default => false,
        };
    }

    public function requiresAuthentication(): bool
    {
        return match ($this) {
            self::SPOTIFY, self::APPLE_MUSIC => true,
            default => false,
        };
    }
}
