<?php

namespace domain\Product\ProductPrice\Repository;

use domain\PointSale\PointSale\PointSale;
use domain\Product\Product\Product;
use domain\Product\ProductPrice\Service\ProductPriceDefinition;
use domain\User\User\User;
use domain\User\UserGroup\UserGroup;
use domain\_\AbstractRepositoryQuery;

class ProductPriceRepositoryQuery extends AbstractRepositoryQuery
{
    protected ProductPriceDefinition $definition;

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

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

    public function filterByUser(User $user): self
    {
        $this->andWhere(['id_user' => $user->id]);
        return $this;
    }

    public function filterByUserGroup(UserGroup $userGroup): self
    {
        $this->andWhere(['id_user_group' => $userGroup->id]);
        return $this;
    }

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

    public function filterByFromQuantity(float $fromQuantity): self
    {
        $this->andWhere(['from_quantity' => $fromQuantity]);
        return $this;
    }
}