<?php

namespace App\Filament\Resources\Articles\Tables;

use Filament\Actions\BulkActionGroup;
use Filament\Actions\DeleteBulkAction;
use Filament\Actions\EditAction;
use Filament\Tables\Columns\IconColumn;
use Filament\Tables\Columns\ImageColumn;
use Filament\Tables\Columns\TextColumn;
use Filament\Tables\Table;

use App\Enums\Rubrique;
use Filament\Tables\Filters\SelectFilter;

class ArticlesTable
{
    public static function configure(Table $table): Table
    {
        return $table
            ->columns([
                TextColumn::make('titre')
                ->searchable()
                ->limit(45),
            TextColumn::make('rubrique')
                ->badge(),
            IconColumn::make('publie')
                ->boolean()
                ->label('Publié'),
            TextColumn::make('created_at')
                ->dateTime('d/m/Y')
                ->label('Créé le'),
            ])
         ->filters([
            SelectFilter::make('rubrique')
                ->options(Rubrique::class),
        ])
            ->recordActions([
                EditAction::make(),
            ])
            ->toolbarActions([
                BulkActionGroup::make([
                    DeleteBulkAction::make(),
                ]),
            ]);
    }
}
