<?php

namespace AutoAdmin\Bundle\Content\Duplicator;

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

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

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

        return $duplicate;
    }
}
