<?php

namespace KupShop\FeedsBundle;

use KupShop\CatalogBundle\ProductList\ProductCollection;

class FeedProductCollection extends ProductCollection
{
    /** @var bool */
    protected $photos = false;

    /** @var bool */
    protected $sections = false;

    /** @var bool */
    protected $parameters = false;

    /** @var ProductCollection */
    protected $collections;

    /** @var bool */
    protected $links = false;

    /** @var bool */
    protected $variationLabels = false;

    /** @var bool */
    protected $storesInStore = false;

    /** @var bool */
    protected $gifts = false;

    protected bool $sets = false;

    protected bool $templates = false;

    /** @var bool */
    protected $quantityDiscounts = false;

    /** @var bool */
    protected $productOfSuppliersInStore = false;

    /** @var bool */
    protected $suppliers = false;

    /** @var bool */
    protected $pricelists = false;

    protected bool $charges = false;
    protected bool $attachments = false;
    protected bool $productLabels = false;
    protected bool $producers = false;
    protected bool $reservations = false;

    public function fetchPhotos($size, $type = null, bool $fetchVariationPhotos = true)
    {
        if ($this->photos) {
            return;
        }
        parent::fetchPhotos($size, $type, $fetchVariationPhotos);
        $this->photos = true;
    }

    public function fetchSections()
    {
        if ($this->sections) {
            return;
        }
        parent::fetchSections();
        $this->sections = true;
    }

    public function fetchParameters($parameters = null)
    {
        if ($this->parameters) {
            return;
        }
        parent::fetchParameters($parameters);
        $this->parameters = true;
    }

    public function fetchCollections()
    {
        if (isset($this->collections)) {
            return $this->collections;
        }

        return $this->collections = parent::fetchCollections();
    }

    public function fetchLinks()
    {
        if ($this->links) {
            return;
        }
        parent::fetchLinks();
        $this->links = true;
    }

    public function fetchVariationLabels()
    {
        if ($this->variationLabels) {
            return;
        }
        parent::fetchVariationLabels();
        $this->variationLabels = true;
    }

    public function fetchStoresInStore()
    {
        if ($this->storesInStore) {
            return;
        }
        parent::fetchStoresInStore();
        $this->storesInStore = true;
    }

    public function fetchGifts()
    {
        if ($this->gifts) {
            return;
        }

        parent::fetchGifts();
        $this->gifts = true;
    }

    public function fetchSets()
    {
        if ($this->sets) {
            return;
        }
        parent::fetchSets();
        $this->sets = true;
    }

    public function fetchCharges()
    {
        if ($this->charges) {
            return;
        }
        parent::fetchCharges();

        $this->charges = true;
    }

    public function fetchTemplates(): void
    {
        if ($this->templates) {
            return;
        }

        parent::fetchTemplates();

        $this->templates = true;
    }

    public function fetchQuantityDiscounts(): void
    {
        if ($this->quantityDiscounts) {
            return;
        }

        parent::fetchQuantityDiscounts();
        $this->quantityDiscounts = true;
    }

    public function fetchProductOfSuppliersInStore()
    {
        if ($this->productOfSuppliersInStore) {
            return;
        }

        parent::fetchProductOfSuppliersInStore();
        $this->productOfSuppliersInStore = true;
    }

    public function fetchSuppliers()
    {
        if ($this->suppliers) {
            return;
        }

        parent::fetchSuppliers();
        $this->suppliers = true;
    }

    public function fetchPricelists()
    {
        if ($this->pricelists) {
            return;
        }
        parent::fetchPricelists();
        $this->pricelists = true;
    }

    public function fetchAttachments()
    {
        if ($this->attachments) {
            return;
        }

        parent::fetchAttachments();
        $this->attachments = true;
    }

    public function fetchProductLabels(?string $visibility = null): void
    {
        if ($this->productLabels) {
            return;
        }

        parent::fetchProductLabels($visibility);
        parent::fetchProductLabelsCouponsAndDiscounts();

        $this->productLabels = true;
    }

    public function fetchProducers(): void
    {
        if ($this->producers) {
            return;
        }

        parent::fetchProducers();

        $this->producers = true;
    }

    public function fetchReservations()
    {
        if ($this->reservations) {
            return;
        }

        parent::fetchReservations();

        $this->reservations = true;
    }
}
