<?php

namespace App\Factory\Blog;

use App\Core\Factory\FactoryInterface;
use App\Entity\Blog\Comment;
use App\Entity\Blog\Post;
use App\Entity\Blog\PostFollow as Entity;

class PostFollowFactory implements FactoryInterface
{
    public function create(Post $post, Comment $comment): Entity
    {
        $entity = new Entity();
        $entity
            ->setPost($post)
            ->setComment($comment)
            ->setIsEnabled(false)
            ->setHash(hash('sha256', bin2hex(random_bytes(32))))
        ;

        return $entity;
    }
}
