<?php

namespace domain\Distribution\ProductDistribution;

use domain\Distribution\Distribution\Distribution;
use domain\Product\Product\Product;
use domain\_\AbstractRepositoryQuery;

class ProductDistributionRepositoryQuery extends AbstractRepositoryQuery
{
    protected ProductDistributionDefinition $definition;

    public function loadDependencies(): void
    {
        $this->loadDefinition(ProductDistributionDefinition::class);
    }

    public function filterByDistribution(Distribution $distribution): self
    {
        $this->andWhere(['id_distribution' => $distribution->id]);

        return $this;
    }

    public function filterByProduct(Product $product): self
    {
        $this->andWhere(['id_product' => $product->id]);

        return $this;
    }
}