<?php

namespace AppBundle\Entity\Billing;

use AppBundle\Entity\AccessAndFunction\Access;
use AppBundle\Entity\AccessAndFunction\AccessFamily;
use AppBundle\Entity\Organization\Organization;
use AppBundle\Entity\Product\FictionalIntangible;
use AppBundle\Entity\Product\Intangible;
use AppBundle\Entity\Traits\BillingRuleTrait;
use AppBundle\Entity\Traits\LockableTrait;
use AppBundle\Enum\Billing\PeriodicityTypeEnum;
use Doctrine\ORM\Mapping as ORM;
use Dunglas\ApiBundle\Annotation\Iri;
use Symfony\Component\Validator\Constraints as Assert;
use Doctrine\Common\Collections\ArrayCollection;
use Symfony\Component\Serializer\Annotation\Groups;
use AppBundle\Annotation\DefaultField;
use AppBundle\Entity\Traits\TimestampableEntity;
use AppBundle\Entity\Traits\CreatorUpdaterEntity;

/**
 * Correspond à une ligne de facturation pour un Access
 * (@see FictionalIntangible)
 *
 * @Iri("http://schema.org/AccessFictionalIntangible")
 */
#[ORM\Entity]
class AccessFictionalIntangible
{
    use TimestampableEntity;
    use CreatorUpdaterEntity;
    use BillingRuleTrait;
    /**
     * @var int
     */
    #[ORM\Column(type: 'integer')]
    #[ORM\Id]
    #[ORM\GeneratedValue(strategy: 'AUTO')]
    #[Groups(['accessfictionalintangible'])]
    private $id;
    /**
     * @var Access
     */
    #[Assert\Valid]
    #[ORM\ManyToOne(targetEntity: 'AppBundle\Entity\AccessAndFunction\Access', inversedBy: 'accessFictionalIntangibles', cascade: ['persist'])]
    #[Groups(['accessfictionalintangible'])]
    private $access;
    /**
     * @var AccessFamily
     */
    #[Assert\Valid]
    #[ORM\ManyToOne(targetEntity: 'AppBundle\Entity\AccessAndFunction\AccessFamily', inversedBy: 'accessFictionalIntangibles', cascade: ['persist'])]
    #[Groups(['accessfictionalintangible'])]
    private $accessFamily;
    /**
     * @var FictionalIntangible
     */
    #[ORM\ManyToOne(targetEntity: 'AppBundle\Entity\Product\FictionalIntangible')]
    #[ORM\JoinColumn(nullable: false)]
    #[Assert\NotNull]
    #[Groups(['accessfictionalintangible'])]
    private $fictionalIntangible;
    /**
     * @var ArrayCollection<BillingIntangibleExcludeDate>
     */
    #[Assert\Valid]
    #[ORM\OneToMany(targetEntity: 'BillingIntangibleExcludeDate', mappedBy: 'accessFictionalIntangible', cascade: ['persist'], orphanRemoval: true)]
    #[Groups(['accessfictionalintangible'])]
    private $billingIntangibleExcludeDates;
    /**
     * The constructor
     */
    public function __construct() {
        $this->billingIntangibleExcludeDates = new ArrayCollection();
    }
    /**
     * Sets id.
     *
     * @param int $id
     *
     * @return $this
     */
    public function setId($id)
    {
        $this->id = $id;

        return $this;
    }
    /**
     * Gets id.
     *
     * @return int
     */
    public function getId()
    {
        return $this->id;
    }
    /**
     * Set access
     *
     * @param \AppBundle\Entity\AccessAndFunction\Access $access
     *
     * @return AccessFictionalIntangible
     */
    public function setAccess(\AppBundle\Entity\AccessAndFunction\Access $access = null)
    {
        $access->addAccessFictionalIntangible($this);
        $this->access = $access;

        return $this;
    }
    /**
     * Get access
     *
     * @return \AppBundle\Entity\AccessAndFunction\Access
     */
    public function getAccess()
    {
        return $this->access;
    }
    /**
     * Set fictionalIntangible
     *
     * @param \AppBundle\Entity\Product\FictionalIntangible $fictionalIntangible
     *
     * @return AccessFictionalIntangible
     */
    public function setFictionalIntangible(\AppBundle\Entity\Product\FictionalIntangible $fictionalIntangible)
    {
        $this->fictionalIntangible = $fictionalIntangible;

        return $this;
    }
    /**
     * Get fictionalIntangible
     *
     * @return \AppBundle\Entity\Product\FictionalIntangible
     */
    public function getFictionalIntangible()
    {
        return $this->fictionalIntangible;
    }
    /**
     * Set accessFamily
     *
     * @param \AppBundle\Entity\AccessAndFunction\AccessFamily $accessFamily
     *
     * @return AccessFictionalIntangible
     */
    public function setAccessFamily(\AppBundle\Entity\AccessAndFunction\AccessFamily $accessFamily = null)
    {
        $accessFamily->addAccessFictionalIntangible($this);
        $this->accessFamily = $accessFamily;

        return $this;
    }
    /**
     * Get accessFamily
     *
     * @return \AppBundle\Entity\AccessAndFunction\AccessFamily
     */
    public function getAccessFamily()
    {
        return $this->accessFamily;
    }
    /**
     * Add billingIntangibleExcludeDate
     *
     * @param \AppBundle\Entity\Billing\BillingIntangibleExcludeDate $billingIntangibleExcludeDate
     *
     * @return AccessFictionalIntangible
     */
    public function addBillingIntangibleExcludeDate(\AppBundle\Entity\Billing\BillingIntangibleExcludeDate $billingIntangibleExcludeDate)
    {
        $this->billingIntangibleExcludeDates[] = $billingIntangibleExcludeDate;

        return $this;
    }
    /**
     * Remove billingIntangibleExcludeDate
     *
     * @param \AppBundle\Entity\Billing\BillingIntangibleExcludeDate $billingIntangibleExcludeDate
     */
    public function removeBillingIntangibleExcludeDate(\AppBundle\Entity\Billing\BillingIntangibleExcludeDate $billingIntangibleExcludeDate)
    {
        $this->billingIntangibleExcludeDates->removeElement($billingIntangibleExcludeDate);
    }
    /**
     * Get billingIntangibleExcludeDates
     *
     * @return \Doctrine\Common\Collections\Collection
     */
    public function getBillingIntangibleExcludeDates()
    {
        return $this->billingIntangibleExcludeDates;
    }
}
