<?php
declare(strict_types=1);

namespace App\Entity\Product;

//use DH\Auditor\Provider\Doctrine\Auditing\Annotation\Auditable;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
use Symfony\Component\Serializer\Annotation\Groups;

/**
 * Classe ... qui ...
 */
//#[Auditable]
#[ORM\Entity]
class IntangiblePriceAndDiscount
{
    #[ORM\Id]
    #[ORM\Column]
    #[ORM\GeneratedValue]
    #[Groups("access_people_ref")]
    private ?int $id = null;

    #[ORM\OneToMany(mappedBy: 'intangiblePriceAndDiscount', targetEntity: IntangibleDiscountDetail::class, cascade: ['persist'], orphanRemoval: true)]
    private Collection $intangibleDiscountDetails;

    public function __construct()
    {
        $this->intangibleDiscountDetails = new ArrayCollection();
    }

    public function getId(): ?int
    {
        return $this->id;
    }

    /**
     * @return Collection<int, IntangibleDiscountDetail>
     */
    public function getIntangibleDiscountDetails(): Collection
    {
        return $this->intangibleDiscountDetails;
    }

    public function addIntangibleDiscountDetail(IntangibleDiscountDetail $intangibleDiscountDetail): self
    {
        if (!$this->intangibleDiscountDetails->contains($intangibleDiscountDetail)) {
            $this->intangibleDiscountDetails[] = $intangibleDiscountDetail;
            $intangibleDiscountDetail->setIntangiblePriceAndDiscount($this);
        }

        return $this;
    }

    public function removeIntangibleDiscountDetail(IntangibleDiscountDetail $intangibleDiscountDetail): self
    {
        if ($this->intangibleDiscountDetails->removeElement($intangibleDiscountDetail)) {
            // set the owning side to null (unless already changed)
            if ($intangibleDiscountDetail->getIntangiblePriceAndDiscount() === $this) {
                $intangibleDiscountDetail->setIntangiblePriceAndDiscount(null);
            }
        }

        return $this;
    }
}