<?php

namespace App\Modules\Loan\Filaments\Actions;

use App\Modules\Loan\Models\Loan;
use App\Modules\Loan\Repositories\LoanRepository;
use Filament\Actions\Action;
use Illuminate\Contracts\View\View;

class ShowLoanRemainingAction
{
    public static function make(): Action
    {
        return Action::make('show_loan_remaining')
            ->label(__('Show remaining loan'))
            ->icon('heroicon-o-banknotes')
            ->requiresConfirmation(false)
            ->modal()
            ->modalContent(fn (Loan $record): View => LoanRepository::make()->showRemainingLoan($record))
            ->modalFooterActions([]);
    }
}
