<?php

namespace AutoAdmin\Bundle\Content\Entity\Duplicators;

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

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

    /**
     * @param ContentReferenceInterface $entity
     * @param ContentReferenceInterface $duplicate
     *
     * @return ContentReferenceInterface
     */
    public function duplicate($entity, $duplicate, $parent = null)
    {
        $duplicate->setPendingDelete($entity->isPendingDelete());
        $duplicate->setReferencedSlug($entity->getReferencedSlug());
        $duplicate->setReferencedAction($entity->getReferencedAction());
        $duplicate->setReferencedIdentifier($entity->getReferencedIdentifier());
        $duplicate->setReferencedLocale($entity->getReferencedLocale());

        return $duplicate;
    }
}
