<?php

namespace AutoAdmin\Bundle\Content\Entity\Duplicators;

use AutoAdmin\Bundle\Content\Model\SlugInterface;

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

    /**
     * @param SlugInterface $entity
     * @param SlugInterface $duplicate
     *
     * @return SlugInterface
     */
    public function duplicate($entity, $duplicate, $parent = null)
    {
        $duplicate->setSlug($entity->getSlug() . '-copy-' . uniqid());

        return $duplicate;
    }
}