<?php

namespace App\Notifications;

use App\Models\CompanyRegistration;
use Illuminate\Bus\Queueable;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Notifications\Messages\MailMessage;
use Illuminate\Notifications\Notification;

class CompanyRegistrationReceivedNotification extends Notification implements ShouldQueue
{
    use Queueable;

    /**
     * Create a new notification instance.
     */
    public function __construct(
        public CompanyRegistration $submission
    ) {}

    /**
     * Get the notification's delivery channels.
     *
     * @return array<int, string>
     */
    public function via(object $notifiable): array
    {
        return ['mail'];
    }

    /**
     * Get the mail representation of the notification.
     */
    public function toMail(object $notifiable): MailMessage
    {
        return (new MailMessage)
            ->subject('KYC Submission Received - InsureData')
            ->greeting('Dear ' . $this->submission->company_name . ',')
            ->line('Thank you for submitting your Corporate KYC registration form.')
            ->line('Your submission has been received and is currently under review by our team.')
            ->line('**Submission Details:**')
            ->line('Company Name: ' . $this->submission->company_name)
            ->line('Email: ' . $this->submission->email_address)
            ->line('Submission Date: ' . $this->submission->created_at->format('F d, Y'))
            ->line('Our team will review your submission and get back to you within 3-5 business days.')
            ->line('If approved, you will receive an invitation email to set up your company admin account.')
            ->line('Thank you for choosing InsureData.');
    }

    /**
     * Get the array representation of the notification.
     *
     * @return array<string, mixed>
     */
    public function toArray(object $notifiable): array
    {
        return [
            'submission_id' => $this->submission->id,
            'company_name' => $this->submission->company_name,
        ];
    }
}
