<?php

namespace App\Filament\Resources\EmotionResource\Pages;

use App\Filament\Resources\EmotionResource;
use App\Services\Audit\SuperAdminAuditLogger;
use Filament\Actions;
use Filament\Resources\Pages\ManageRecords;

class ManageEmotions extends ManageRecords
{
    protected static string $resource = EmotionResource::class;

    protected function getHeaderActions(): array
    {
        return [
            Actions\CreateAction::make()
                ->after(fn (array $data, $record) => app(SuperAdminAuditLogger::class)->recordModelMutation(
                    'created',
                    $record,
                    SuperAdminAuditLogger::fieldsMetadata($data),
                    static::class
                )),
            Actions\Action::make('import')
                ->label(__('admin.common.import_csv'))
                ->icon('heroicon-o-arrow-up-tray')
                ->url(EmotionResource::getUrl('import')),
            Actions\Action::make('template')
                ->label(__('admin.common.download_csv_template'))
                ->icon('heroicon-o-document-arrow-down')
                ->url(url('/super-admin/templates/emotions.csv')),
        ];
    }
}
