<?php

declare(strict_types=1);

namespace App\Entity\Billing;

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

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

    #[ORM\ManyToOne(targetEntity: Organization::class, cascade: [], inversedBy: 'familyQuotientModels')]
    #[ORM\JoinColumn(nullable: false)]
    protected Organization $organization;

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

    /** @var Collection<int, IntangiblePriceAndDiscount> */
    #[ORM\OneToMany(targetEntity: IntangiblePriceAndDiscount::class, mappedBy: 'familyQuotientModel', cascade: [], orphanRemoval: false)]
    protected Collection $intangiblePriceAndDiscounts;

    /** @var Collection<int, BillingSettingRent> */
    #[ORM\OneToMany(targetEntity: BillingSettingRent::class, mappedBy: 'familyQuotientModel', cascade: [], orphanRemoval: false)]
    protected Collection $billingSettingRents;

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

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

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

        return $this;
    }

    public function getOrganization(): Organization
    {
        return $this->organization;
    }

    public function setOrganization(Organization $organization): self
    {
        $this->organization = $organization;

        return $this;
    }

    public function getFamilyQuotientBands(): Collection
    {
        return $this->familyQuotientBands;
    }

    public function addFamilyQuotientBand(FamilyQuotientBand $familyQuotientBand): self
    {
        if (!$this->familyQuotientBands->contains($familyQuotientBand)) {
            $this->familyQuotientBands[] = $familyQuotientBand;
            $familyQuotientBand->setFamilyQuotientModel($this);
        }

        return $this;
    }

    public function removeFamilyQuotientBand(FamilyQuotientBand $familyQuotientBand): self
    {
        if ($this->familyQuotientBands->removeElement($familyQuotientBand)) {
            $familyQuotientBand->setFamilyQuotientModel(null);
        }

        return $this;
    }

    public function getIntangiblePriceAndDiscounts(): Collection
    {
        return $this->intangiblePriceAndDiscounts;
    }

    public function addIntangiblePriceAndDiscount(IntangiblePriceAndDiscount $intangiblePriceAndDiscount): self
    {
        if (!$this->intangiblePriceAndDiscounts->contains($intangiblePriceAndDiscount)) {
            $this->intangiblePriceAndDiscounts[] = $intangiblePriceAndDiscount;
            $intangiblePriceAndDiscount->setFamilyQuotientModel($this);
        }

        return $this;
    }

    public function removeIntangiblePriceAndDiscount(IntangiblePriceAndDiscount $intangiblePriceAndDiscount): self
    {
        if ($this->intangiblePriceAndDiscounts->removeElement($intangiblePriceAndDiscount)) {
            $intangiblePriceAndDiscount->setFamilyQuotientModel(null);
        }

        return $this;
    }

    public function getBillingSettingRents(): Collection
    {
        return $this->billingSettingRents;
    }

    public function addBillingSettingRent(BillingSettingRent $billingSettingRent): self
    {
        if (!$this->billingSettingRents->contains($billingSettingRent)) {
            $this->billingSettingRents[] = $billingSettingRent;
            $billingSettingRent->setFamilyQuotientModel($this);
        }

        return $this;
    }

    public function removeBillingSettingRent(BillingSettingRent $billingSettingRent): self
    {
        if ($this->billingSettingRents->removeElement($billingSettingRent)) {
            $billingSettingRent->setFamilyQuotientModel(null);
        }

        return $this;
    }
}
