<?php

namespace App\Modules\Admin\Tenancy\Jobs;

use App\Modules\Admin\Tenancy\Services\TrialExpiryNotifier;
use Illuminate\Bus\Queueable;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Foundation\Bus\Dispatchable;
use Illuminate\Queue\InteractsWithQueue;
use Illuminate\Queue\SerializesModels;

class DispatchTrialExpiringRemindersJob implements ShouldQueue
{
    use Dispatchable;
    use InteractsWithQueue;
    use Queueable;
    use SerializesModels;

    public function __construct(
        public readonly int $withinDays = 3,
    ) {}

    public function handle(TrialExpiryNotifier $notifier): void
    {
        $notifier->notifyExpiringTrials($this->withinDays);
    }
}
