<?php

namespace AutoAdmin\Bundle\Content\Duplicator;

use AutoAdmin\Bundle\Content\Model\DomainEntityInterface;

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

    /**
     * @param DomainEntityInterface $entity
     * @param DomainEntityInterface $duplicate
     *
     * @return DomainEntityInterface
     */
    public function duplicate(object $entity, object $duplicate, ?object $parent = null): object
    {
        $duplicate->setDomain($this->appendSlugSuffix($entity->getDomain()));
        $duplicate->setLocales($entity->getLocales());

        return $duplicate;
    }
}
