<?php

namespace AppBundle\Entity\Booking;

use AppBundle\Entity\AccessAndFunction\Access;
use AppBundle\Entity\Billing\EducationalProjectIntangible;
use AppBundle\Entity\Product\Equipment;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\ORM\Mapping as ORM;
use Dunglas\ApiBundle\Annotation\Iri;
use Symfony\Component\Serializer\Annotation\Groups;
use Symfony\Component\Validator\Constraints as Assert;

use AppBundle\Validator\Constraints\Booking as OpentalentEvent;

/**
 * Prestation pédagogique
 *
 * @Iri("http://schema.org/EducationalProject")
 * @OpentalentEvent\EducationnalProject()
 */
#[ORM\Entity(repositoryClass: 'AppBundle\Entity\Booking\Repository\EducationalProjectRepository')]
class EducationalProject extends AbstractBooking
{
    /**
     * @var ArrayCollection<EducationalProjectRecur>
     */
    #[Assert\Valid]
    #[ORM\OneToMany(targetEntity: 'EducationalProjectRecur', mappedBy: 'event', cascade: ['persist'], orphanRemoval: true)]
    #[Groups(['educationalproject_bookingrecur', 'planning_detail'])]
    protected $eventRecur;
    /**
     * @var ArrayCollection<EducationalProject>
     */
    #[ORM\OneToMany(targetEntity: 'EducationalProject', mappedBy: 'parent', orphanRemoval: true)]
    #[Groups(['educationalproject_timeline'])]
    private $timeline;
    /**
     * @var \AppBundle\Entity\Booking\EducationalProject
     */
    #[ORM\ManyToOne(targetEntity: 'EducationalProject', inversedBy: 'timeline')]
    #[Groups(['educationalproject'])]
    private $parent;
    /**
     * @var string
     */
    #[Assert\Type(type: 'string')]
    #[Assert\Choice(callback: ['\AppBundle\Enum\Booking\EducationalProjectTimelineTypeEnum', 'toArray'], multiple: false, min: 1)]
    #[ORM\Column(type: 'string', length: 255, nullable: true)]
    #[Groups(['educationalproject'])]
    private $type;
    /**
     * @var string
     */
    #[ORM\Column(type: 'string', length: 35, nullable: true)]
    #[Assert\Type(type: 'string')]
    #[Groups(['educationalproject', 'planning_detail', 'educationalproject_details'])]
    private $object;
    /**
     * @var Access
     */
    #[ORM\ManyToOne(targetEntity: 'AppBundle\Entity\AccessAndFunction\Access', inversedBy: 'silentPartners')]
    #[ORM\JoinColumn(referencedColumnName: 'id', nullable: true, onDelete: 'SET NULL')]
    #[Groups(['educationalproject', 'planning_detail', 'educationalproject_details'])]
    private $silentPartner;
    /**
     * @var EducationalProjectPublic
     */
    #[ORM\ManyToOne(targetEntity: 'EducationalProjectPublic', inversedBy: 'educationalProjects')]
    #[ORM\JoinColumn(referencedColumnName: 'id', nullable: true, onDelete: 'SET NULL')]
    #[Groups(['educationalproject', 'planning_detail', 'educationalproject_details'])]
    private $public;
    /**
     * @var float
     */
    #[ORM\Column(type: 'float', nullable: true)]
    #[Assert\Type(type: 'float')]
    #[Groups(['educationalproject', 'planning_detail', 'educationalproject_details'])]
    private $amount;
    /**
     * @var EducationalProjectAge
     */
    #[Assert\Valid]
    #[ORM\OneToOne(targetEntity: 'EducationalProjectAge', cascade: ['persist'], orphanRemoval: true, fetch: 'EAGER')]
    #[ORM\JoinColumn(nullable: true)]
    #[Groups(['educationalproject', 'educationalproject_details', 'planning_detail'])]
    private $ageDistribution;
    /**
     * @var Access
     */
    #[ORM\ManyToOne(targetEntity: 'AppBundle\Entity\AccessAndFunction\Access', inversedBy: 'operationalPartners')]
    #[ORM\JoinColumn(referencedColumnName: 'id', nullable: true, onDelete: 'SET NULL')]
    #[Groups(['educationalproject', 'planning_detail', 'educationalproject_details'])]
    private $operationalPartner;
    /**
     * @var Access
     */
    #[ORM\ManyToMany(targetEntity: 'AppBundle\Entity\AccessAndFunction\Access')]
    #[ORM\JoinTable(name: 'educationalproject_financier')]
    #[Groups(['educationalproject_access', 'planning_detail', 'educationalproject_details'])]
    private $financiers;
    /**
     * @var string
     */
    #[ORM\Column(type: 'string', length: 255, nullable: true)]
    #[Assert\Type(type: 'string')]
    #[Assert\Choice(callback: ['\AppBundle\Enum\Booking\EducationalProjectEstablishmentEnum', 'toArray'])]
    #[Groups(['educationalproject', 'planning_detail', 'educationalproject_details'])]
    private $establishment;
    /**
     * @var string
     */
    #[ORM\Column(type: 'string', length: 255, nullable: true)]
    #[Assert\Type(type: 'string')]
    #[Assert\Choice(callback: ['\AppBundle\Enum\Booking\EducationalProjectSpecialClassEnum', 'toArray'])]
    #[Groups(['educationalproject', 'planning_detail', 'educationalproject_details'])]
    private $specialClass;
    /**
     * @var string
     */
    #[ORM\Column(type: 'string', length: 255, nullable: true)]
    #[Assert\Type(type: 'string')]
    #[Assert\Choice(callback: ['\AppBundle\Enum\Booking\EducationalProjectEducationalDeviceEnum', 'toArray'])]
    #[Groups(['educationalproject', 'planning_detail', 'educationalproject_details'])]
    private $educationalDevice;
    /**
     * @var string
     */
    #[ORM\Column(type: 'text', nullable: true)]
    #[Assert\Type(type: 'string')]
    #[Groups(['educationalproject', 'planning_detail'])]
    private $report;
    /**
     * @var ArrayCollection<File>
     */
    #[ORM\ManyToMany(targetEntity: 'AppBundle\Entity\Core\File')]
    #[Groups(['educationalproject_file'])]
    private $files;
    /**
     * @var ArrayCollection<EducationalProjectIntangible>
     */
    #[Assert\Valid]
    #[ORM\OneToMany(targetEntity: 'AppBundle\Entity\Billing\EducationalProjectIntangible', mappedBy: 'educationalProject', cascade: ['persist'], orphanRemoval: true)]
    #[Groups(['educationalprojects_educationalprojectintangible', 'planning_detail', 'educationalproject_details'])]
    private $educationalProjectIntangibles;
    /**
     * @var ArrayCollection<EducationalProject>
     */
    #[Assert\Valid]
    #[ORM\OneToMany(targetEntity: 'AppBundle\Entity\Billing\EducationalProjectPayer', mappedBy: 'educationalProjectReceiver', cascade: ['persist'], orphanRemoval: true)]
    #[Groups(['educationalproject_educationalprojectpayer', 'planning_detail', 'educationalproject_details'])]
    private $billingReceivers;
    /**
     * @var ArrayCollection<BillLine>
     */
    #[ORM\OneToMany(targetEntity: 'AppBundle\Entity\Billing\BillLine', mappedBy: 'educationalProject', orphanRemoval: true)]
    #[Groups(['educationalproject_billline', 'planning_detail'])]
    private $billLines;
    /**
     * var ArrayCollection<AttendanceBooking>
     */
    #[Assert\Valid]
    #[ORM\OneToMany(targetEntity: 'AppBundle\Entity\Booking\AttendanceBooking', cascade: ['persist'], mappedBy: 'educationalProject', orphanRemoval: true)]
    #[ORM\JoinColumn(nullable: false)]
    #[Groups(['educationalproject_attendancebooking', 'educationalproject_details', 'planning_detail'])]
    private $attendanceBooking;
    public function __construct()
    {
        parent::__construct();
        $this->files = new ArrayCollection();
        $this->financiers = new ArrayCollection();
        $this->educationalProjectIntangibles = new ArrayCollection();
        $this->billingReceivers = new ArrayCollection();
        $this->attendanceBooking = new ArrayCollection();
    }
    /**
     * Sets object.
     * 
     * @param string $object
     * 
     * @return $this
     */
    public function setObject($object)
    {
        $this->object = $object;

        return $this;
    }
    /**
     * Gets object.
     * 
     * @return string
     */
    public function getObject()
    {
        return $this->object;
    }
    /**
     * Sets public.
     * 
     * @param EducationalProjectPublic $educationalProjectPublic
     * 
     * @return $this
     */
    public function setPublic(EducationalProjectPublic $public = null)
    {
        $this->public = $public;

        return $this;
    }
    /**
     * Gets public.
     * 
     * @return EducationalProjectPublic
     */
    public function getPublic()
    {
        return $this->public;
    }
    /**
     * Sets amount.
     * 
     * @param float $amount
     * 
     * @return $this
     */
    public function setAmount($amount)
    {
        $this->amount = floatval($amount);

        return $this;
    }
    /**
     * Gets amount.
     * 
     * @return float
     */
    public function getAmount()
    {
        return $this->amount;
    }
    /**
     * Sets establishment.
     * 
     * @param string $establishment
     * 
     * @return $this
     */
    public function setEstablishment($establishment)
    {
        $this->establishment = $establishment;

        return $this;
    }
    /**
     * Gets establishment.
     * 
     * @return string
     */
    public function getEstablishment()
    {
        return $this->establishment;
    }
    /**
     * Sets specialClass.
     * 
     * @param string $specialClass
     * 
     * @return $this
     */
    public function setSpecialClass($specialClass)
    {
        $this->specialClass = $specialClass;

        return $this;
    }
    /**
     * Gets specialClass.
     * 
     * @return string
     */
    public function getSpecialClass()
    {
        return $this->specialClass;
    }
    /**
     * Sets educationalDevice.
     * 
     * @param string $educationalDevice
     * 
     * @return $this
     */
    public function setEducationalDevice($educationalDevice)
    {
        $this->educationalDevice = $educationalDevice;

        return $this;
    }
    /**
     * Gets educationalDevice.
     * 
     * @return string
     */
    public function getEducationalDevice()
    {
        return $this->educationalDevice;
    }
    /**
     * Sets report.
     * 
     * @param string $report
     * 
     * @return $this
     */
    public function setReport($report)
    {
        $this->report = $report;

        return $this;
    }
    /**
     * Gets report.
     * 
     * @return string
     */
    public function getReport()
    {
        return $this->report;
    }
    /**
     * Set ageDistribution
     *
     * @param \AppBundle\Entity\Booking\EducationalProjectAge $ageDistribution
     *
     * @return EducationalProject
     */
    public function setAgeDistribution(\AppBundle\Entity\Booking\EducationalProjectAge $ageDistribution = null)
    {
        $this->ageDistribution = $ageDistribution;

        return $this;
    }
    /**
     * Get ageDistribution
     *
     * @return \AppBundle\Entity\Booking\EducationalProjectAge
     */
    public function getAgeDistribution()
    {
        return $this->ageDistribution;
    }
    /**
     * Add file
     *
     * @param \AppBundle\Entity\Core\File $file
     *
     * @return EducationalProject
     */
    public function addFile(\AppBundle\Entity\Core\File $file)
    {
        $this->files[] = $file;

        return $this;
    }
    /**
     * Remove file
     *
     * @param \AppBundle\Entity\Core\File $file
     */
    public function removeFile(\AppBundle\Entity\Core\File $file)
    {
        $this->files->removeElement($file);
    }
    /**
     * Get files
     *
     * @return \Doctrine\Common\Collections\Collection
     */
    public function getFiles()
    {
        return $this->files;
    }
    /**
     * Set silentPartner
     *
     * @param \AppBundle\Entity\AccessAndFunction\Access $silentPartner
     *
     * @return EducationalProject
     */
    public function setSilentPartner(\AppBundle\Entity\AccessAndFunction\Access $silentPartner = null)
    {
        $this->silentPartner = $silentPartner;

        return $this;
    }
    /**
     * Get silentPartner
     *
     * @return \AppBundle\Entity\AccessAndFunction\Access
     */
    public function getSilentPartner()
    {
        return $this->silentPartner;
    }
    /**
     * Set operationalPartner
     *
     * @param \AppBundle\Entity\AccessAndFunction\Access $operationalPartner
     *
     * @return EducationalProject
     */
    public function setOperationalPartner(\AppBundle\Entity\AccessAndFunction\Access $operationalPartner = null)
    {
        $this->operationalPartner = $operationalPartner;

        return $this;
    }
    /**
     * Get operationalPartner
     *
     * @return \AppBundle\Entity\AccessAndFunction\Access
     */
    public function getOperationalPartner()
    {
        return $this->operationalPartner;
    }
    /**
     * Add financier
     *
     * @param \AppBundle\Entity\AccessAndFunction\Access $financier
     *
     * @return EducationalProject
     */
    public function addFinancier(\AppBundle\Entity\AccessAndFunction\Access $financier)
    {
        $this->financiers[] = $financier;

        return $this;
    }
    /**
     * Remove financier
     *
     * @param \AppBundle\Entity\AccessAndFunction\Access $financier
     */
    public function removeFinancier(\AppBundle\Entity\AccessAndFunction\Access $financier)
    {
        $this->financiers->removeElement($financier);
    }
    /**
     * Get financiers
     *
     * @return \Doctrine\Common\Collections\Collection
     */
    public function getFinanciers()
    {
        return $this->financiers;
    }
    /**
     * {@inheritdoc}
     */
    public function getParticipants() {
        $participants = new ArrayCollection();        
        return $participants;        
    }
    /**
     * Set type
     *
     * @param string $type
     *
     * @return EducationalProject
     */
    public function setType($type)
    {
        $this->type = $type;

        return $this;
    }
    /**
     * Get type
     *
     * @return string
     */
    public function getType()
    {
        return $this->type;
    }
    /**
     * Add timeline
     *
     * @param \AppBundle\Entity\Booking\EducationalProject $timeline
     *
     * @return EducationalProject
     */
    public function addTimeline(\AppBundle\Entity\Booking\EducationalProject $timeline)
    {
        $this->timeline[] = $timeline;

        return $this;
    }
    /**
     * Remove timeline
     *
     * @param \AppBundle\Entity\Booking\EducationalProject $timeline
     */
    public function removeTimeline(\AppBundle\Entity\Booking\EducationalProject $timeline)
    {
        $this->timeline->removeElement($timeline);
    }
    /**
     * Get timeline
     *
     * @return \Doctrine\Common\Collections\Collection
     */
    public function getTimeline()
    {
        return $this->timeline;
    }
    /**
     * Set parent
     *
     * @param \AppBundle\Entity\Booking\EducationalProject $parent
     *
     * @return EducationalProject
     */
    public function setParent(\AppBundle\Entity\Booking\EducationalProject $parent = null)
    {
        $this->parent = $parent;

        return $this;
    }
    /**
     * Get parent
     *
     * @return \AppBundle\Entity\Booking\EducationalProject
     */
    public function getParent()
    {
        return $this->parent;
    }
    /**
     * Add educationalProjectIntangible
     *
     * @param \AppBundle\Entity\Billing\EducationalProjectIntangible $educationalProjectIntangible
     *
     * @return EducationalProject
     */
    public function addEducationalProjectIntangible(\AppBundle\Entity\Billing\EducationalProjectIntangible $educationalProjectIntangible)
    {
        $educationalProjectIntangible->setEducationalProject($this);
        $this->educationalProjectIntangibles[] = $educationalProjectIntangible;

        return $this;
    }
    /**
     * Remove educationalProjectIntangible
     *
     * @param \AppBundle\Entity\Billing\EducationalProjectIntangible $educationalProjectIntangible
     */
    public function removeEducationalProjectIntangible(\AppBundle\Entity\Billing\EducationalProjectIntangible $educationalProjectIntangible)
    {
        $educationalProjectIntangible->setEducationalProject(null);
        $this->educationalProjectIntangibles->removeElement($educationalProjectIntangible);
    }
    /**
     * Get educationalProjectIntangibles
     *
     * @return \Doctrine\Common\Collections\Collection
     */
    public function getEducationalProjectIntangibles()
    {
        return $this->educationalProjectIntangibles;
    }
    /**
     * Add billingReceiver
     *
     * @param \AppBundle\Entity\Billing\EducationalProjectPayer $billingReceiver
     *
     * @return EducationalProject
     */
    public function addBillingReceiver(\AppBundle\Entity\Billing\EducationalProjectPayer $billingReceiver)
    {
        $billingReceiver->setEducationalProjectReceiver($this);
        $this->billingReceivers[] = $billingReceiver;

        return $this;
    }
    /**
     * Remove billingReceiver
     *
     * @param \AppBundle\Entity\Billing\EducationalProjectPayer $billingReceiver
     */
    public function removeBillingReceiver(\AppBundle\Entity\Billing\EducationalProjectPayer $billingReceiver)
    {
        $this->billingReceivers->removeElement($billingReceiver);
    }
    /**
     * Get billingReceivers
     *
     * @return \Doctrine\Common\Collections\Collection
     */
    public function getBillingReceivers()
    {
        return $this->billingReceivers;
    }
    /**
     * Add billLine
     *
     * @param \AppBundle\Entity\Billing\BillLine $billLine
     *
     * @return EducationalProject
     */
    public function addBillLine(\AppBundle\Entity\Billing\BillLine $billLine)
    {
        $this->billLines[] = $billLine;

        return $this;
    }
    /**
     * Remove billLine
     *
     * @param \AppBundle\Entity\Billing\BillLine $billLine
     */
    public function removeBillLine(\AppBundle\Entity\Billing\BillLine $billLine)
    {
        $this->billLines->removeElement($billLine);
    }
    /**
     * Get billLines
     *
     * @return \Doctrine\Common\Collections\Collection
     */
    public function getBillLines()
    {
        return $this->billLines;
    }
    /**
     * Add attendanceBooking
     *
     * @param \AppBundle\Entity\Booking\AttendanceBooking $attendanceBooking
     *
     * @return AbstractBooking
     */
    public function addAttendanceBooking(\AppBundle\Entity\Booking\AttendanceBooking $attendanceBooking)
    {
        $attendanceBooking->setEducationalProject($this);
        $this->attendanceBooking[] = $attendanceBooking;

        return $this;
    }
    /**
     * Remove attendanceBooking
     *
     * @param \AppBundle\Entity\Booking\AttendanceBooking $attendanceBooking
     */
    public function removeAttendanceBooking(\AppBundle\Entity\Booking\AttendanceBooking $attendanceBooking)
    {
        $this->attendanceBooking->removeElement($attendanceBooking);
    }
    /**
     * Get attendanceBooking
     *
     * @return \Doctrine\Common\Collections\Collection
     */
    public function getAttendanceBooking()
    {
        return $this->attendanceBooking;
    }
}
