<?php

namespace AutoAdmin\Bundle\Content\Entity\Duplicators;

use AutoAdmin\Bundle\Content\Model\DomainEntityInterface;

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

    /**
     * @param DomainEntityInterface $entity
     * @param DomainEntityInterface $duplicate
     *
     * @return DomainEntityInterface
     */
    public function duplicate($entity, $duplicate, $parent = null)
    {
        $duplicate->setDomain($entity->getDomain() . '-copy-' . uniqid());
        $duplicate->setLocales($entity->getLocales());

        return $duplicate;
    }
}