<?php

namespace AutoAdmin\Bundle\Content\Entity\Duplicators;

use AutoAdmin\Bundle\Media\Model\MediaInterface;

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

    /**
     * @param MediaInterface $entity
     * @param MediaInterface $duplicate
     *
     * @return MediaInterface
     */
    public function duplicate($entity, $duplicate, $parent = null)
    {
        $duplicate->setMediaChangedAt(time());
        $duplicate->setMapping($entity->getMapping());
        $duplicate->setMappingConfig($entity->getMappingConfig());

        return $duplicate;
    }
}