<?php

namespace App\Modules\Card\Filament\Actions;

use App\Modules\Card\Models\Card;
use App\Modules\CardBalance\Repositories\CardBalanceRepository;
use Filament\Actions\Action;
use Illuminate\Contracts\View\View;

class CheckCardBalanceAction
{
    public static function make(): Action
    {
        return Action::make('card_balance')
            ->label(__('Card balance'))
            ->icon('heroicon-o-credit-card')
            ->requiresConfirmation(false)
            ->modal()
            ->modalContent(fn (Card $record): View => CardBalanceRepository::make()->showCardBalance($record))
            ->modalFooterActions([]);
    }
}
