<?php

declare(strict_types=1);

namespace App\Filament\Resources\DberpDictionaryTypes\Tables;

use Filament\Actions\EditAction;
use Filament\Tables\Columns\IconColumn;
use Filament\Tables\Columns\TextColumn;
use Filament\Tables\Table;

class DberpDictionaryTypesTable
{
    public static function configure(Table $table): Table
    {
        return $table
            ->defaultSort('sort_order', 'asc')
            ->columns([
                TextColumn::make('code')
                    ->label(__('dberp.fields.dict_type_code'))
                    ->searchable(),
                TextColumn::make('name')
                    ->label(__('dberp.fields.dict_type_name'))
                    ->searchable(),
                IconColumn::make('is_delete_locked')
                    ->label(__('dberp.fields.system_locked'))
                    ->boolean(),
                TextColumn::make('sort_order')
                    ->label(__('dberp.fields.sort_order'))
                    ->numeric()
                    ->sortable(),
                TextColumn::make('updated_at')
                    ->label(__('dberp.fields.updated_at'))
                    ->dateTime()
                    ->sortable()
                    ->toggleable(isToggledHiddenByDefault: true),
            ])
            ->filters([
                //
            ])
            ->recordActions([
                EditAction::make(),
            ]);
    }
}
