<?php

namespace App\Filament\Supplier\Resources\ProductStocks\Tables;

use App\Enums\StockStatusEnum;
use Filament\Actions\EditAction;
use Filament\Tables\Columns\TextColumn;
use Filament\Tables\Table;

class ProductStocksTable
{
    public static function configure(Table $table): Table
    {
        return $table
            ->columns([
                TextColumn::make('name')
                    ->label('Termék neve')
                    ->searchable()
                    ->sortable(),

                TextColumn::make('sku')
                    ->label('Cikkszám')
                    ->searchable(),

                TextColumn::make('stock_status')
                    ->label('Készlet státusz')
                    ->badge()
                    ->formatStateUsing(fn (StockStatusEnum $state) => $state->label())
                    ->color(fn (StockStatusEnum $state) => $state->color()),
            ])
            ->recordAction('edit')
            ->actions([
                EditAction::make()->label('Státusz módosítása'),
            ]);
    }
}
