<?php

namespace App\Nova\Resources\Ecommerce\Channel\Fields;

use Ebess\AdvancedNovaMediaLibrary\Fields\Images;
use Laravel\Nova\Fields\DateTime;
use Laravel\Nova\Fields\ID;
use Laravel\Nova\Fields\Text;

class ChannelFieldsForIndex
{
    /**
     * Fields for index
     */
    public static function make(): array
    {
        return [
            ID::make()->hidden(),

            Images::make(__('Image'), 'uploads')
                ->conversionOnIndexView('thumb200x200'),

            Text::make(__('Name'), 'name')
                ->sortable(),

            Text::make(__('User'), fn ($model) => $model->user?->fullname ?? '-'),

            DateTime::make(__('Created at'), 'created_at')
                ->turkmenDate()
                ->sortable(),
        ];
    }
}
