<?php

namespace App\Enums;

enum UserRole: string
{
    case User       = 'user';
    case BetaTester = 'beta_tester';
    case Affiliate  = 'affiliate';
    case Support    = 'support';
    case Developer  = 'developer';
    case Admin      = 'admin';
    case SuperAdmin = 'super_admin';

    public function label(): string
    {
        return match($this) {
            self::User       => 'Nutzer',
            self::BetaTester => 'Beta-Tester',
            self::Affiliate  => 'Affiliate',
            self::Support    => 'Support',
            self::Developer  => 'Developer',
            self::Admin      => 'Administrator',
            self::SuperAdmin => 'Super Admin',
        };
    }

    public function badgeBg(): string
    {
        return match($this) {
            self::User       => 'bg-gray-100',
            self::BetaTester => 'bg-orange-50',
            self::Affiliate  => 'bg-fuchsia-50',
            self::Support    => 'bg-blue-50',
            self::Developer  => 'bg-green-50',
            self::Admin      => 'bg-purple-50',
            self::SuperAdmin => 'bg-yellow-50',
        };
    }

    public function badgeText(): string
    {
        return match($this) {
            self::User       => 'text-gray-500',
            self::BetaTester => 'text-orange-700',
            self::Affiliate  => 'text-fuchsia-700',
            self::Support    => 'text-blue-700',
            self::Developer  => 'text-green-700',
            self::Admin      => 'text-purple-700',
            self::SuperAdmin => 'text-yellow-700',
        };
    }

    public function hierarchy(): int
    {
        return match($this) {
            self::User       => 0,
            self::BetaTester => 1,
            self::Affiliate  => 1,
            self::Support    => 2,
            self::Developer  => 3,
            self::Admin      => 4,
            self::SuperAdmin => 5,
        };
    }

    public function icon(): string
    {
        return match($this) {
            self::User       => 'user',
            self::BetaTester => 'beaker',
            self::Affiliate  => 'link',
            self::Support    => 'chat-bubble-left-right',
            self::Developer  => 'code-bracket',
            self::Admin      => 'cog-6-tooth',
            self::SuperAdmin => 'shield-check',
        };
    }
}
