<?php

declare(strict_types=1);

namespace App\Filament\Components\Table;

use Filament\Tables\Columns\TextColumn;

class ParentTextColumn extends TextColumn
{
    public static function create(): static
    {
        return parent::make('parent_id')
            ->translateLabel()
            ->sortable()
            ->getStateUsing(function ($record) {
                return $record->parent?->title;
            })
            ->toggleable()
            ->toggledHiddenByDefault();
    }
}
