<?php

declare(strict_types=1);

namespace App\Entity\Billing;

use ApiPlatform\Metadata\ApiResource;
use App\Entity\Product\IntangibleDiscountDetail;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;

/**
 * TODO: documenter.
 */
#[ApiResource(operations: [])]
#[ORM\Entity]
class FamilyQuotientBandDetail
{
    #[ORM\Id]
    #[ORM\Column]
    #[ORM\GeneratedValue]
    private int $id;

    #[ORM\ManyToOne(targetEntity: FamilyQuotientBand::class, cascade: [], inversedBy: 'familyQuotientBandDetails')]
    #[ORM\JoinColumn(nullable: false)]
    protected mixed $familyQuotientBand;

    #[ORM\ManyToOne(targetEntity: ResidenceArea::class, cascade: [], inversedBy: 'intangibleDiscountDetails')]
    #[ORM\JoinColumn(referencedColumnName: 'id', nullable: true, onDelete: 'SET NULL')]
    protected ?ResidenceArea $residenceArea;

    /** @var Collection<int, IntangibleDiscountDetail> */
    #[ORM\OneToMany(targetEntity: IntangibleDiscountDetail::class, mappedBy: 'familyQuotientBandDetail', cascade: [], orphanRemoval: true)]
    protected Collection $intangibleDiscountDetails;

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

    public function setId(int $id): self
    {
        $this->id = $id;

        return $this;
    }

    public function getFamilyQuotientBand(): mixed
    {
        return $this->familyQuotientBand;
    }

    public function setFamilyQuotientBand(mixed $familyQuotientBand): self
    {
        $this->familyQuotientBand = $familyQuotientBand;

        return $this;
    }

    public function getResidenceArea(): ?ResidenceArea
    {
        return $this->residenceArea;
    }

    public function setResidenceArea(?ResidenceArea $residenceArea): self
    {
        $this->residenceArea = $residenceArea;

        return $this;
    }

    public function getIntangibleDiscountDetails(): Collection
    {
        return $this->intangibleDiscountDetails;
    }

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

        return $this;
    }

    public function removeIntangibleDiscountDetail(IntangibleDiscountDetail $intangibleDiscountDetail): self
    {
        $this->intangibleDiscountDetails->removeElement($intangibleDiscountDetail);

        return $this;
    }
}
