<?php

declare(strict_types=1);

namespace App\Mail;

use App\Models\User;
use Illuminate\Bus\Queueable;
use Illuminate\Mail\Mailable;
use Illuminate\Mail\Mailables\Attachment;
use Illuminate\Mail\Mailables\Content;
use Illuminate\Mail\Mailables\Envelope;
use Illuminate\Queue\SerializesModels;

final class OrganisationUserRegistration extends Mailable
{
    use Queueable, SerializesModels;

    public function __construct(
        private readonly User $user,
        private readonly string $newPassword,
    ) {
    }

    public function envelope(): Envelope
    {
        return new Envelope(
            subject: 'Gegevens adminportaal',
        );
    }

    public function content(): Content
    {
        return new Content(
            markdown: 'mails.users.organisation-registration',
            with: [
                'user' => $this->user,
                'newPassword' => $this->newPassword,
            ]
        );
    }

    public function attachments(): array
    {
        return [
            Attachment::fromStorageDisk('local', '/public/instructions.pdf')
                ->as('Instructies_beheertool_startpagina_Aldoc_Topmotive.pdf')
                ->withMime('application/pdf'),
        ];
    }
}
