<?php

namespace AutoAdmin\Bundle\Content\Entity\Duplicators;

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

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

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

        return $duplicate;
    }
}