<?php

namespace AutoAdmin\Bundle\Content\Entity\Duplicators;

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

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

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

        return $duplicate;
    }
}
