<?php

namespace AutoAdmin\Bundle\Content\Duplicator;

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

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

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

        return $duplicate;
    }
}
