<?php

namespace App\Exports;

use App\Models\EventPurchase;
use Filament\Actions\Exports\Exporter;
use Filament\Actions\Exports\Models\Export;
use Illuminate\Database\Eloquent\Builder;
use Illuminate\Support\Collection;

class EventPurchaseExporter extends Exporter
{
    public static function getModel(): string
    {
        return EventPurchase::class;
    }

    public static function getColumns(): array
    {
        return [
            EventPurchase::raw('tenant.name'),
            EventPurchase::raw('package_id'),
            EventPurchase::raw('credits_added'),
            EventPurchase::raw('price'),
            EventPurchase::raw('platform'),
            EventPurchase::raw('purchased_at'),
            EventPurchase::raw('transaction_id'),
        ];
    }


    public static function getCompletedNotificationBody(Export $export): string
    {
        $body = "Your Event Purchases export has completed and is ready for download. {$export->successful_rows} purchases were exported.";

        return $body;
    }
}