<?php

namespace App\Filament\Resources\PhotoboothSettings\Tables;

use App\Services\Audit\SuperAdminAuditLogger;
use Filament\Actions\EditAction;
use Filament\Tables;
use Filament\Tables\Table;

class PhotoboothSettingsTable
{
    public static function configure(Table $table): Table
    {
        return $table
            ->columns([
                Tables\Columns\TextColumn::make('ftp_port')
                    ->label(__('Port'))
                    ->sortable(),
                Tables\Columns\TextColumn::make('rate_limit_per_minute')
                    ->label(__('Uploads/Minute'))
                    ->sortable(),
                Tables\Columns\TextColumn::make('expiry_grace_days')
                    ->label(__('Ablauf +Tage'))
                    ->sortable(),
                Tables\Columns\IconColumn::make('require_ftps')
                    ->label(__('FTPS'))
                    ->boolean(),
                Tables\Columns\TextColumn::make('updated_at')
                    ->since()
                    ->label(__('Aktualisiert')),
            ])
            ->recordActions([
                EditAction::make()
                    ->after(fn (array $data, $record) => app(SuperAdminAuditLogger::class)->recordModelMutation(
                        'updated',
                        $record,
                        SuperAdminAuditLogger::fieldsMetadata($data),
                        static::class
                    )),
            ])
            ->headerActions([])
            ->bulkActions([]);
    }
}
