<?php

namespace common\logic\Distribution\PointSaleDistribution\Repository;

use common\logic\AbstractRepositoryQuery;
use common\logic\Distribution\Distribution\Model\Distribution;
use common\logic\Distribution\PointSaleDistribution\Service\PointSaleDistributionDefinition;
use common\logic\PointSale\PointSale\Model\PointSale;
use yii\db\ActiveQuery;

class PointSaleDistributionRepositoryQuery extends AbstractRepositoryQuery
{
    protected PointSaleDistributionDefinition $definition;

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

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

        return $this;
    }

    public function filterByPointSale(PointSale $pointSale): self
    {
        $this->andWhere(['id_point_sale' => $pointSale->id]);

        return $this;
    }
}