<?php

namespace App\Filament\Central\Resources\SubscriptionResource\Pages;

use App\Filament\Central\Resources\SubscriptionResource;
use App\Models\Central\Subscription;
use Filament\Resources\Pages\CreateRecord;

class CreateSubscription extends CreateRecord
{
    protected static string $resource = SubscriptionResource::class;

    protected function mutateFormDataBeforeCreate(array $data): array
    {
        if (empty($data['invoice_number'])) {
            $data['invoice_number'] = Subscription::generateInvoiceNumber();
        }
        return $data;
    }
}
