import {
    Activity,
    Building2,
    CheckCircle2,
    Clock3,
    CreditCard,
    DollarSign,
    Package as PackageIcon,
    PowerOff,
    Receipt,
    Snowflake,
    Sparkles,
    UserMinus,
    Users,
    XCircle,
} from 'lucide-react';

export const bgColor = (title: string) => {
    const normalizedTitle = title.toLowerCase();

    if (normalizedTitle.includes('revenue') || normalizedTitle.includes('amount')) {
        return {
            bg: 'bg-emerald-100',
            icons: 'text-emerald-600',
            icon: DollarSign,
        };
    }

    if (normalizedTitle.includes('transaction')) {
        return {
            bg: 'bg-sky-100',
            icons: 'text-sky-600',
            icon: Receipt,
        };
    }

    if (normalizedTitle.includes('completed')) {
        return {
            bg: 'bg-green-100',
            icons: 'text-green-600',
            icon: CheckCircle2,
        };
    }

    if (normalizedTitle.includes('failed')) {
        return {
            bg: 'bg-red-100',
            icons: 'text-red-600',
            icon: XCircle,
        };
    }

    if (normalizedTitle.includes('pending')) {
        return {
            bg: 'bg-amber-100',
            icons: 'text-amber-600',
            icon: Clock3,
        };
    }

    if (normalizedTitle.includes('subscription')) {
        return {
            bg: 'bg-indigo-100',
            icons: 'text-indigo-600',
            icon: CreditCard,
        };
    }

    if (normalizedTitle.includes('expired')) {
        return {
            bg: 'bg-rose-100',
            icons: 'text-rose-600',
            icon: Clock3,
        };
    }

    if (normalizedTitle.includes('active tenants')) {
        return {
            bg: 'bg-green-100',
            icons: 'text-green-600',
            icon: Building2,
        };
    }

    if (normalizedTitle.includes('inactive tenants')) {
        return {
            bg: 'bg-purple-100',
            icons: 'text-purple-600',
            icon: UserMinus,
        };
    }

    if (normalizedTitle.includes('freezed tenants')) {
        return {
            bg: 'bg-blue-100',
            icons: 'text-blue-600',
            icon: Snowflake,
        };
    }

    if (normalizedTitle.includes('terminated tenants')) {
        return {
            bg: 'bg-red-100',
            icons: 'text-red-600',
            icon: PowerOff,
        };
    }

    if (normalizedTitle === 'active' || normalizedTitle === 'active users' || normalizedTitle === 'total contacts' || normalizedTitle === 'active contacts') {
        return {
            bg: 'bg-green-100',
            icons: 'text-green-600',
            icon: CheckCircle2,
        };
    }

    if (
        normalizedTitle === 'inactive users' ||
        normalizedTitle === 'inactive' ||
        normalizedTitle === 'inactive contacts' ||
        normalizedTitle === 'inactive packages'
    ) {
        return {
            bg: 'bg-purple-100',
            icons: 'text-purple-600',
            icon: UserMinus,
        };
    }

    if (normalizedTitle === 'invited users' || normalizedTitle === 'freezed' || normalizedTitle === 'linked contacts') {
        return {
            bg: 'bg-blue-100',
            icons: 'text-blue-600',
            icon: Snowflake,
        };
    }

    if (normalizedTitle === 'deleted users' || normalizedTitle === 'terminated' || normalizedTitle === 'unlinked contacts') {
        return {
            bg: 'bg-red-100',
            icons: 'text-red-600',
            icon: PowerOff,
        };
    }

    if (normalizedTitle === 'total tenants') {
        return {
            bg: 'bg-indigo-100',
            icons: 'text-indigo-600',
            icon: Building2,
        };
    }

    if (normalizedTitle === 'total packages' || normalizedTitle === 'active packages') {
        return {
            bg: 'bg-emerald-100',
            icons: 'text-emerald-600',
            icon: PackageIcon,
        };
    }

    if (normalizedTitle === 'total features') {
        return {
            bg: 'bg-pink-100',
            icons: 'text-pink-600',
            icon: Sparkles,
        };
    }

    if (normalizedTitle === 'pending jobs') {
        return {
            bg: 'bg-amber-100',
            icons: 'text-amber-600',
            icon: Activity,
        };
    }

    switch (normalizedTitle) {
        case 'active':
            return {
                bg: 'bg-green-100',
                icons: 'text-green-600',
                icon: Users,
            };
        case 'inactive':
            return {
                bg: 'bg-purple-100',
                icons: 'text-purple-600',
                icon: UserMinus,
            };
        case 'freezed':
            return {
                bg: 'bg-blue-100',
                icons: 'text-blue-600',
                icon: Snowflake,
            };
        case 'terminated':
            return {
                bg: 'bg-red-100',
                icons: 'text-red-600',
                icon: PowerOff,
            };
        case 'tenants':
            return {
                bg: 'bg-indigo-100',
                icons: 'text-indigo-600',
                icon: Building2,
            };
        case 'packages':
            return {
                bg: 'bg-emerald-100',
                icons: 'text-emerald-600',
                icon: PackageIcon,
            };
        case 'jobs':
            return {
                bg: 'bg-amber-100',
                icons: 'text-amber-600',
                icon: Activity,
            };
        case 'features':
            return {
                bg: 'bg-pink-100',
                icons: 'text-pink-600',
                icon: Sparkles,
            };
        default:
            return {
                bg: 'bg-gray-100',
                icons: 'text-gray-600',
                icon: Users,
            };
    }
};
