<?php

namespace domain\Product\ProductPointSale;

use domain\PointSale\PointSale\PointSale;
use domain\Product\Product\Product;
use domain\_\AbstractBuilder;

class ProductPointSaleBuilder extends AbstractBuilder
{
    public function instanciateProductPointSale(): ProductPointSale
    {
        $productPointSale = new ProductPointSale();

        return $productPointSale;
    }

    public function createProductPointSale(Product $product, PointSale $pointSale, bool $available): ProductPointSale
    {
        $productPointSale = $this->instanciateProductPointSale();
        $productPointSale->populateProduct($product);
        $productPointSale->populatePointSale($pointSale);
        $productPointSale->available = $available;

        $this->saveCreate($productPointSale);

        return $productPointSale;
    }
}