<?php

namespace App\Mail;

use Illuminate\Bus\Queueable;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Mail\Mailable;
use Illuminate\Queue\SerializesModels;
use Illuminate\Support\Facades\Log;

use App\Models\Ticket;

class SupportTicket extends Mailable
{
    use Queueable, SerializesModels;

    /**
     * Create a new message instance.
     *
     * @return void
     */
	public $name;
	public $email;
	public $user_message;
	public $type;
	public $id;

    public function __construct(Ticket $ticket, String $user_message)
    {
		$this->name = $ticket->user->name;
		$this->email = $ticket->user->email;
		$this->user_message = $user_message;
		$this->type = $ticket->type;
		$this->id = $ticket->id;
    }

    /**
     * Build the message.
     *
     * @return $this
     */
    public function build()
    {
		$this->view('support-ticket');
		$this->subject("Ticket: $this->id, $this->type");
		$this->replyTo($this->email);
		return $this;
    }
}
