<?php
// components/Ui/Card.php
// Unified card container helper for list-style UI cards

namespace Components\Ui;

final class Card
{
    /**
     * Return the default container class list for clickable/non-clickable cards.
     * Matches the trigger_module.php styling by default.
     */
    public static function baseContainerClass(bool $interactive = false, string $extra = ''): string
    {
        $base = 'relative border border-divider ring-0 ring-inset transition-all bg-elevated hover:bg-elevated/50 rounded-2xl overflow-hidden dark:bg-zinc-800';

        if ($interactive) {
            $base .= ' cursor-pointer select-none';
        }

        if ($extra !== '') {
            $base .= ' ' . trim($extra);
        }

        return trim($base);
    }

    /**
     * Return the default vertical stack container classes used for card lists.
     * This mirrors trigger_module list spacing (space-y-4) and should be used
     * wherever a vertical list of Card containers is rendered.
     */
    public static function listStackClass(string $extra = ''): string
    {
        $cls = 'space-y-4';
        if ($extra !== '') { $cls .= ' ' . trim($extra); }
        return trim($cls);
    }

    /**
     * Optional alternative: a single-column grid with unified gap matching stack spacing.
     * Useful when callers prefer grid semantics but want consistent spacing.
     */
    public static function listGridClass(string $extra = ''): string
    {
        $cls = 'grid grid-cols-1 gap-4';
        if ($extra !== '') { $cls .= ' ' . trim($extra); }
        return trim($cls);
    }


    public static function flowClasses(): string {
        return 'relative overflow-hidden rounded-lg mx-3 mb-3 bg-divider/20 border border-divider/50 dark:border-muted/10 bg_dotted_pattern';
    }
}
