<?php

namespace AutoAdmin\Bundle\Content\Duplicator;

use AutoAdmin\Bundle\Content\Entity\Interfaces\CacheRuleInterface;

class CacheRuleDuplicator extends AbstractDuplicator
{
    public function supportInterfaces(): array
    {
        return [
            CacheRuleInterface::class
        ];
    }

    /**
     * @param CacheRuleInterface $entity
     * @param CacheRuleInterface $duplicate
     *
     * @return CacheRuleInterface
     */
    public function duplicate(object $entity, object $duplicate, ?object $parent = null): object
    {
        $duplicate->setPattern($entity->getPattern());
        $duplicate->setIsExcluded($entity->isExcluded());
        $duplicate->setExactMatch($entity->isExactMatch());

        return $duplicate;
    }
}
