<?php

namespace AutoAdmin\Bundle\Content\Duplicator;

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

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

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

        return $duplicate;
    }
}
