<?php

declare(strict_types=1);

namespace App\Filament\Resources\Links\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 LinksTable
{
    public static function configure(Table $table): Table
    {
        return $table
            ->columns([
                AdminTable::ellipsis(
                    TextColumn::make('name')
                        ->label(__('admin.fields.name'))
                        ->searchable(),
                ),
                AdminTable::ellipsis(
                    TextColumn::make('url')
                        ->label(__('admin.fields.url'))
                        ->searchable(),
                ),
                TextColumn::make('display_order')
                    ->label(__('admin.fields.display_order'))
                    ->numeric()
                    ->sortable(),
                IconColumn::make('visible')
                    ->label(__('admin.fields.visible'))
                    ->boolean(),
                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(),
                ]),
            ]);
    }
}
