<?php

namespace App\Modules\Admin\Tenancy\Notifications;

use Illuminate\Bus\Queueable;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Notifications\Notification;

class PlanLimitAlmostReachedNotification extends Notification implements ShouldQueue
{
    use Queueable;

    public function __construct(
        public readonly string $limitKey,
        public readonly int $used,
        public readonly int $cap,
    ) {}

    /**
     * @return list<string>
     */
    public function via(object $notifiable): array
    {
        return ['database'];
    }

    /**
     * @return array<string, mixed>
     */
    public function toArray(object $notifiable): array
    {
        return [
            'type' => 'plan_limit_almost',
            'limit_key' => $this->limitKey,
            'used' => $this->used,
            'cap' => $this->cap,
            'title' => __('plan_limits.notifications.almost_title'),
            'body' => __('plan_limits.notifications.almost_body', [
                'used' => $this->used,
                'cap' => $this->cap,
            ]),
            'upgrade_url' => route('dashboard.index'),
        ];
    }
}
