<?php

namespace App\Filament\Resources\Manage\Cooperations\Pages;

use App\Enums\RoleEnum;
use App\Filament\Exports\CooperationExcelExport;
use App\Filament\Resources\Manage\Cooperations\CooperationResource;
use Filament\Actions\CreateAction;
use Filament\Resources\Pages\ListRecords;
use pxlrbt\FilamentExcel\Actions\ExportAction;

class ListCooperations extends ListRecords
{
    protected static string $resource = CooperationResource::class;

    protected static ?string $title = 'Kerja Sama';

    protected function getHeaderActions(): array
    {
        return [
            CreateAction::make()
                ->label('Tambah')
                ->visible(! auth()->user()->hasRole(RoleEnum::PERUSAHAAN->value)),

            ExportAction::make()
                ->exports([
                    CooperationExcelExport::make(),
                ])
                ->color('success')
                ->icon(null),
        ];
    }
}
