<?php

declare(strict_types=1);

namespace App\Filament\Resources\Plugins\Tables;

use App\Filament\Support\AdminTable;
use Filament\Actions\BulkActionGroup;
use Filament\Actions\DeleteBulkAction;
use Filament\Actions\EditAction;
use Filament\Tables\Columns\IconColumn;
use Filament\Tables\Columns\TextColumn;
use Filament\Tables\Table;

class PluginsTable
{
    public static function configure(Table $table): Table
    {
        return $table
            ->columns([
                AdminTable::ellipsis(
                    TextColumn::make('name')
                        ->label(__('admin.fields.name'))
                        ->searchable(),
                ),
                TextColumn::make('version')
                    ->label(__('admin.fields.version'))
                    ->searchable(),
                IconColumn::make('enabled')
                    ->label(__('admin.fields.enabled'))
                    ->boolean(),
                TextColumn::make('path')
                    ->label(__('admin.fields.path'))
                    ->searchable(),
                TextColumn::make('created_at')
                    ->label(__('admin.fields.created_at'))
                    ->dateTime()
                    ->sortable()
                    ->toggleable(isToggledHiddenByDefault: true),
                TextColumn::make('updated_at')
                    ->label(__('admin.fields.updated_at'))
                    ->dateTime()
                    ->sortable()
                    ->toggleable(isToggledHiddenByDefault: true),
            ])
            ->filters([
                //
            ])
            ->recordActions([
                EditAction::make(),
            ])
            ->toolbarActions([
                BulkActionGroup::make([
                    DeleteBulkAction::make(),
                ]),
            ]);
    }
}
