<?php

declare(strict_types=1);

namespace App\Mail;

use Illuminate\Bus\Queueable;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Mail\Mailable;
use Illuminate\Mail\Mailables\Content;
use Illuminate\Mail\Mailables\Envelope;
use Illuminate\Queue\SerializesModels;

class ResellerWelcomeMail extends Mailable implements ShouldQueue
{
    use Queueable, SerializesModels;

    public function __construct(
        public readonly string $resellerName,
        public readonly string $username,
        public readonly string $email,
        public readonly string $temporaryPassword = '',
        public readonly ?string $panelUrl = null,
    ) {}

    public function envelope(): Envelope
    {
        return new Envelope(
            subject: 'Onoxsoft Bayi Hesabınız Hazır — Hoş Geldiniz',
            tags: ['reseller', 'welcome'],
        );
    }

    public function content(): Content
    {
        return new Content(
            view: 'emails.reseller.welcome',
            with: [
                'resellerName' => $this->resellerName,
                'username' => $this->username,
                'email' => $this->email,
                'temporaryPassword' => $this->temporaryPassword,
                'panelUrl' => $this->panelUrl ?? config('app.url').'/reseller',
            ],
        );
    }
}
