<?php

declare(strict_types=1);

/*
 * Chill is a software for social workers
 *
 * For the full copyright and license information, please view
 * the LICENSE file that was distributed with this source code.
 */

namespace Chill\TicketBundle\Event;

use Chill\TicketBundle\Entity\Motive;
use Chill\TicketBundle\Entity\Ticket;

final class MotiveUpdateEvent extends TicketUpdateEvent
{
    public function __construct(
        Ticket $ticket,
        public ?Motive $previousMotive = null,
        public ?Motive $newMotive = null,
    ) {
        parent::__construct(TicketUpdateKindEnum::UPDATE_MOTIVE, $ticket);
    }

    public function hasChanges(): bool
    {
        return null !== $this->newMotive || null !== $this->previousMotive;
    }
}
