<?php

namespace AutoAdmin\Bundle\Content\Entity\Duplicators;

use AutoAdmin\Bundle\Content\Model\PublishableInterface;

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

    /**
     * @param PublishableInterface $entity
     * @param PublishableInterface $duplicate
     *
     * @return PublishableInterface
     */
    public function duplicate($entity, $duplicate, $parent = null)
    {
        // duplicate and set as not published
        $duplicate->setPublishable(false);

        return $duplicate;
    }
}