<?php

declare(strict_types=1);

namespace App\Filament\Components\Table;

use Filament\Tables\Columns\TextColumn;

class TotalCountTextColumn extends TextColumn
{
    public static function create(): static
    {
        return static::make('total_count')
            ->translateLabel()
            ->sortable()
            ->formatStateUsing(function ($state) {
                // Convert to Persian numbers
                return str_replace(
                    ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9'],
                    ['۰', '۱', '۲', '۳', '۴', '۵', '۶', '۷', '۸', '۹'],
                    (string) $state
                );
            })
            ->toggleable()
            ->toggledHiddenByDefault();
    }
}
