<?php

namespace AutoAdmin\Bundle\Content\Entity\Duplicators;

use AutoAdmin\Bundle\Content\Model\UpdatedAtInterface;
use DateTime;

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

    /**
     * @param UpdatedAtInterface $entity
     * @param UpdatedAtInterface $duplicate
     *
     * @return UpdatedAtInterface
     */
    public function duplicate($entity, $duplicate, $parent = null)
    {
        $duplicate->setUpdatedAt(new DateTime());

        return $duplicate;
    }
}
