<?php

namespace AutoAdmin\Bundle\Content\Duplicator;

use AutoAdmin\Bundle\Content\Duplicator\Enum\StringDuplicateModeEnum;
use AutoAdmin\Bundle\Content\Model\SlugInterface;

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

    /**
     * @param SlugInterface $entity
     * @param SlugInterface $duplicate
     *
     * @return SlugInterface
     */
    public function duplicate(object $entity, object $duplicate): object
    {
        $duplicate->setSlug($this->suffixes->duplicate($entity->getSlug(), StringDuplicateModeEnum::KEBAB));

        return $duplicate;
    }
}
