<?php

declare(strict_types=1);

namespace Seka\Terminy\Mail\Udalost;

use Illuminate\Support\Str;
use Illuminate\Mail\Mailable;
use Illuminate\Bus\Queueable;
use Seka\Terminy\Dtos\UdalostDTO;
use Illuminate\Queue\SerializesModels;
use Illuminate\Contracts\Queue\ShouldQueue;

/**
 * Class ZrusenaUdalostMail
 *
 * @package Seka\Terminy\Mail\Udalost
 */
final class ZrusenaUdalostMail extends Mailable implements ShouldQueue
{
    use Queueable;
    use SerializesModels;

    /**
     * @var \Seka\Terminy\Dtos\UdalostDTO
     */
    public UdalostDTO $udalost;

    /**
     * ZrusenaUdalostMail constructor.
     *
     * @param \Seka\Terminy\Dtos\UdalostDTO $udalost
     */
    public function __construct(UdalostDTO $udalost)
    {
        $this->udalost = $udalost;
    }

    /**
     * @return mixed
     * @throws \Illuminate\Contracts\Container\BindingResolutionException
     */
    public function build()
    {
        return $this
            ->subject(Str::ucfirst($this->udalost->druh->label))
            ->markdown('Terminy::mail.udalost.public.zrusena')
            ->withUdalost($this->udalost)
            ->replyTo(config('terminy.podpora.email'));
    }
}
