<?php

namespace App\Mail;

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

class MemberStatusMail extends Mailable
{
    use Queueable, SerializesModels;

    public string  $memberName;
    public string  $unitName;
    public string  $status;
    public ?string $reason;
    public string  $planName;
    public string  $planType;
    public string  $planAmount;
    public string  $contactEmail;
    public string  $loginUrl;

    /**
     * Create a new message instance.
     */
    public function __construct(
        string  $memberName,
        string  $unitName,
        string  $status,
        ?string $reason,
        string  $planName,
        string  $planType,
        string  $planAmount,
        string  $contactEmail,
        string  $loginUrl
    ) {
        $this->memberName   = $memberName;
        $this->unitName     = $unitName;
        $this->status       = $status;
        $this->reason       = $reason;
        $this->planName     = $planName;
        $this->planType     = $planType;
        $this->planAmount   = $planAmount;
        $this->contactEmail = $contactEmail;
        $this->loginUrl     = $loginUrl;
    }

    /**
     * Get the message envelope.
     */
    public function envelope(): Envelope
    {
        $subject = $this->status === 'approved'
            ? '🎉 Your ECA Membership has been Approved!'
            : 'Update on Your ECA Membership Application';

        return new Envelope(subject: $subject);
    }

    /**
     * Get the message content definition.
     */
    public function content(): Content
{
    return new Content(
        view: 'emails.member-status',
    );
}

    /**
     * Get the attachments for the message.
     *
     * @return array<int, Attachment>
     */
    public function attachments(): array
    {
        return [];
    }
}
