<?php

namespace AutoAdmin\Bundle\Content\Duplicator;

use AutoAdmin\Bundle\Media\Model\MediaInterface;

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

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

        return $duplicate;
    }
}
