<?php

namespace App\Notifications;

use App\InterviewSchedule;
use App\JobApplication;
use Illuminate\Notifications\Messages\MailMessage;

class ScheduleStatusCandidate extends BaseNotification
{

    private $jobApplication, $interviewSchedule;
    /**
     * Create a new notification instance.
     *
     * @return void
     */
    public function __construct(JobApplication $jobApplication, InterviewSchedule $interviewSchedule)
    {
        parent::__construct();
        $this->jobApplication = $jobApplication;
        $this->interviewSchedule = $interviewSchedule;
    }

    /**
     * Get the notification's delivery channels.
     *
     * @param  mixed  $notifiable
     * @return array
     */
    public function via($notifiable)
    {
        return ['mail', 'database'];
    }

    /**
     * Get the mail representation of the notification.
     *
     * @param  mixed  $notifiable
     * @return \Illuminate\Notifications\Messages\MailMessage
     */
    public function toMail($notifiable)
    {
        //        dd($notifiable);
        return (new MailMessage)
            ->subject(__('email.ScheduleStatusCandidate.subject'))
            ->greeting(__('email.hello') . ' ' . ucwords($notifiable->full_name) . '!')
            ->line(__('email.your') . ' ' . __('email.ScheduleStatusCandidate.text') . ' - ' . ucwords($this->jobApplication->job->title))
            ->line(__('email.ScheduleStatusCandidate.hasBeen') . ' - ' . ucfirst($this->jobApplication->status->status))
            ->line(__('email.thankyouNote'));
    }

    /**
     * Get the array representation of the notification.
     *
     * @param  mixed  $notifiable
     * @return array
     */
    public function toArray($notifiable)
    {
        return [
            'data' => $this->jobApplication->toArray()
        ];
    }
}
