<?php

namespace App\Mail;

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

class WorklogReport extends Mailable
{
    use Queueable, SerializesModels;

    public $tasksByUser;

    public function __construct($tasksByUser)
    {
        $this->tasksByUser = $tasksByUser;
    }

    public function build()
    {
        return $this->markdown('email.worklog')
                    ->subject('[SYSTEM] Daily Report - '.Carbon::yesterday()->setTimezone(env('TIME_ZONE'))->format('Y/m/d'))
                    ->with('tasksByUser', $this->tasksByUser);
    }
}
