<?php

namespace AutoAdmin\Bundle\Content\Duplicator;

use AutoAdmin\Bundle\Content\Entity\Interfaces\RedirectInterface;

class RedirectDuplicator extends AbstractDuplicator
{
    /**
     * @return string[]
     */
    public function supportInterfaces(): array
    {
        return [
            RedirectInterface::class
        ];
    }

    /**
     * @param RedirectInterface $entity
     * @param RedirectInterface $duplicate
     *
     * @return RedirectInterface
     */
    public function duplicate(object $entity, object $duplicate, ?object $parent = null): object
    {
        $duplicate->setOrigin($entity->getOrigin());
        $duplicate->setDestination($entity->getDestination());
        $duplicate->setType($entity->getType());
        $duplicate->setCounter(0);

        return $duplicate;
    }
}
