<?php

namespace AppBundle\Entity\Place;
use AppBundle\Annotation\DefaultField;
use AppBundle\Entity\Booking\Course;
use AppBundle\Entity\Booking\EducationalProject;
use AppBundle\Entity\Booking\Examen;
use AppBundle\Entity\Core\ContactPoint;
use AppBundle\Entity\Organization\Organization;
use AppBundle\Entity\Product\Equipment;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\ORM\Mapping as ORM;
use Symfony\Component\Serializer\Annotation\Groups;
use Symfony\Component\Validator\Constraints as Assert;

/**
 * Lieu physique, bâtiment
 */
#[ORM\Entity(repositoryClass: 'AppBundle\Entity\Place\Repository\PlaceRepository')]
class Place extends AbstractPlace
{
    /**
     * @var string A short description of the item.
     */
    #[Assert\Type(type: 'string')]
    #[ORM\Column(type: 'text', nullable: true)]
    #[Groups(['place', 'place_list'])]
    private $description;
    /**
     * @var ArrayCollection<OpeningHoursSpecification> The opening hours of a certain place.
     */
    #[Assert\Valid]
    #[ORM\ManyToMany(targetEntity: 'OpeningHoursSpecification', cascade: ['persist'], orphanRemoval: true)]
    #[ORM\JoinTable(joinColumns: [], inverseJoinColumns: [])]
    #[ORM\JoinColumn(name: 'place_id', referencedColumnName: 'id')]
    #[ORM\JoinColumn(name: 'openinghoursspecification_id', referencedColumnName: 'id', unique: true)]
    #[Groups(['place_openinghoursspecification'])]
    private $openingHoursSpecification;
    /**
     * @var Organization
     *
     * @DefaultField()
     */
    #[ORM\ManyToOne(targetEntity: 'AppBundle\Entity\Organization\Organization', inversedBy: 'places')]
    #[Groups(['place'])]
    private $organization;
    /**
     * @var ArrayCollection<ContactPoint>
     */
    #[ORM\ManyToMany(targetEntity: 'AppBundle\Entity\Core\ContactPoint', cascade: ['persist'], inversedBy: 'place')]
    #[Assert\Valid]
    #[Groups(['place_contactpoint', 'place_list'])]
    private $contactpoint;
    /**
     * @var bool
     */
    #[Assert\Type(type: 'boolean')]
    #[Assert\NotNull]
    #[ORM\Column(type: 'boolean', options: ['default' => false])]
    #[Groups(['place', 'place_list'])]
    private $internal = false;
    /**
     * @var string
     */
    #[Assert\Type(type: 'string')]
    #[Assert\Choice(callback: ['AppBundle\Enum\Place\SiteStatusEnum', 'toArray'])]
    #[ORM\Column(type: 'string', nullable: true)]
    #[Groups(['place', 'place_list'])]
    private $status;
    /**
     * @var string
     */
    #[Assert\Type(type: 'string')]
    #[Assert\Choice(callback: ['AppBundle\Enum\Place\SiteTypeEnum', 'toArray'])]
    #[ORM\Column(type: 'string', nullable: true)]
    #[Groups(['place', 'place_list'])]
    private $type;
    /**
     * @var bool
     */
    #[Assert\Type(type: 'boolean')]
    #[Assert\NotNull]
    #[ORM\Column(type: 'boolean', options: ['default' => false])]
    #[Groups(['place', 'place_list'])]
    private $sharing = false;
    /**
     * @var bool
     */
    #[Assert\Type(type: 'boolean')]
    #[Assert\NotNull]
    #[ORM\Column(type: 'boolean', options: ['default' => false])]
    #[Groups(['place', 'place_list'])]
    private $practice = false;
    /**
     * @var int
     */
    #[Assert\Type(type: 'integer', message: 'invalid-integer')]
    #[ORM\Column(type: 'integer', nullable: true)]
    #[Groups(['place', 'place_list', 'place_reference'])]
    private $floorSize;
    /**
     * @var int
     */
    #[Assert\Type(type: 'integer', message: 'invalid-integer')]
    #[ORM\Column(type: 'integer', nullable: true)]
    #[Groups(['place', 'place_list', 'place_reference'])]
    private $capacity;
    /**
     * var ArrayCollection<Room>
     */
    #[Assert\Valid]
    #[ORM\OneToMany(targetEntity: 'AppBundle\Entity\Place\Room', cascade: ['persist'], mappedBy: 'place', orphanRemoval: true)]
    #[ORM\JoinColumn(nullable: false)]
    #[Groups(['place_room', 'place_list'])]
    private $rooms;
    /**
     * var ArrayCollection<Control>
     */
    #[Assert\Valid]
    #[ORM\OneToMany(targetEntity: 'AppBundle\Entity\Place\PlaceControl', cascade: ['persist'], mappedBy: 'place', orphanRemoval: true)]
    #[ORM\JoinColumn(nullable: false)]
    #[Groups(['place_control'])]
    private $controls;
    /**
     * var ArrayCollection<Repair>
     */
    #[Assert\Valid]
    #[ORM\OneToMany(targetEntity: 'AppBundle\Entity\Place\PlaceRepair', cascade: ['persist'], mappedBy: 'place', orphanRemoval: true)]
    #[ORM\JoinColumn(nullable: false)]
    #[Groups(['place_repair'])]
    private $repairs;
    /**
     * @var ArrayCollection<Course>
     */
    #[ORM\OneToMany(targetEntity: 'AppBundle\Entity\Booking\Course', mappedBy: 'place')]
    #[Groups(['place_booking'])]
    private $courses;
    /**
     * @var ArrayCollection<EducationalProject>
     */
    #[ORM\OneToMany(targetEntity: 'AppBundle\Entity\Booking\EducationalProject', mappedBy: 'place')]
    #[Groups(['place_booking'])]
    private $educationalProjects;
    /**
     * @var ArrayCollection<Examen>
     */
    #[ORM\OneToMany(targetEntity: 'AppBundle\Entity\Booking\Examen', mappedBy: 'place')]
    #[Groups(['place_booking'])]
    private $examens;
    /**
     * @var ArrayCollection<Equipment>
     */
    #[ORM\OneToMany(targetEntity: 'AppBundle\Entity\Product\Equipment', mappedBy: 'placeStorage')]
    #[Groups(['place_equipment'])]
    private $equipmentStorages;
    /**
     * @var ArrayCollection<Equipment>
     */
    #[ORM\OneToMany(targetEntity: 'AppBundle\Entity\Product\Equipment', mappedBy: 'placeWhereIsUsed')]
    #[Groups(['place_equipment', 'place_list'])]
    private $equipmentUseds;
    /**
     * @var string
     */
    #[ORM\Column(type: 'string', length: 14, nullable: true)]
    #[Assert\Type(type: 'string')]
    #[Groups(['place'])]
    private $siretNumber;
    public function __construct()
    {
        $this->openingHoursSpecification = new ArrayCollection();
        $this->contactpoint = new ArrayCollection();
        $this->rooms = new ArrayCollection();
        $this->controls = new ArrayCollection();
        $this->repairs = new ArrayCollection();
        $this->courses = new ArrayCollection();
        $this->educationalProjects = new ArrayCollection();
        $this->examens = new ArrayCollection();
        $this->equipmentStorages = new ArrayCollection();
        $this->equipmentUseds = new ArrayCollection();
    }
    /**
     * Sets description.
     *
     * @param string $description
     *
     * @return $this
     */
    public function setDescription($description)
    {
        $this->description = $description;

        return $this;
    }
    /**
     * Gets description.
     *
     * @return string
     */
    public function getDescription()
    {
        return $this->description;
    }
    /**
     * Adds openingHoursSpecification.
     *
     * @param OpeningHoursSpecification $openingHoursSpecification
     *
     * @return $this
     */
    public function addOpeningHoursSpecification(OpeningHoursSpecification $openingHoursSpecification)
    {
        $this->openingHoursSpecification[] = $openingHoursSpecification;

        return $this;
    }
    /**
     * Removes openingHoursSpecification.
     *
     * @param OpeningHoursSpecification $openingHoursSpecification
     *
     * @return $this
     */
    public function removeOpeningHoursSpecification(OpeningHoursSpecification $openingHoursSpecification)
    {
        $this->openingHoursSpecification->removeElement($openingHoursSpecification);
        return $this;
    }
    /**
     * Gets openingHoursSpecification.
     *
     * @return ArrayCollection<OpeningHoursSpecification>
     */
    public function getOpeningHoursSpecification()
    {
        return $this->openingHoursSpecification;
    }
    /**
     * Sets organization.
     *
     * @param Organization $organization
     *
     * @return $this
     */
    public function setOrganization(Organization $organization = null)
    {
        $this->organization = $organization;

        return $this;
    }
    /**
     * Gets organization.
     *
     * @return Organization
     */
    public function getOrganization()
    {
        return $this->organization;
    }
    /**
     * Adds contactpoint.
     *
     * @param ContactPoint $contactpoint
     *
     * @return $this
     */
    public function addContactpoint(ContactPoint $contactpoint)
    {
        $this->contactpoint[] = $contactpoint;

        return $this;
    }
    /**
     * Removes contactpoint.
     *
     * @param ContactPoint $contactpoint
     *
     * @return $this
     */
    public function removeContactpoint(ContactPoint $contactpoint)
    {
        $this->contactpoint->removeElement($contactpoint);
        return $this;
    }
    /**
     * Gets contactpoint.
     *
     * @return ArrayCollection<ContactPoint>
     */
    public function getContactpoint()
    {
        return $this->contactpoint;
    }
    /**
     * Sets internal.
     *
     * @param bool $internal
     *
     * @return $this
     */
    public function setInternal($internal)
    {
        $this->internal = $internal;

        return $this;
    }
    /**
     * Gets internal.
     *
     * @return bool
     */
    public function getInternal()
    {
        return $this->internal;
    }
    /**
     * Sets status.
     *
     * @param string $status
     *
     * @return $this
     */
    public function setStatus($status)
    {
        $this->status = $status;

        return $this;
    }
    /**
     * Gets status.
     *
     * @return string
     */
    public function getStatus()
    {
        return $this->status;
    }
    /**
     * Sets type.
     *
     * @param string $type
     *
     * @return $this
     */
    public function setType($type)
    {
        $this->type = $type;

        return $this;
    }
    /**
     * Gets type.
     *
     * @return string
     */
    public function getType()
    {
        return $this->type;
    }
    /**
     * Sets sharing.
     *
     * @param bool $sharing
     *
     * @return $this
     */
    public function setSharing($sharing)
    {
        $this->sharing = $sharing;

        return $this;
    }
    /**
     * Gets sharing.
     *
     * @return bool
     */
    public function getSharing()
    {
        return $this->sharing;
    }
    /**
     * Sets practice.
     *
     * @param bool $practice
     *
     * @return $this
     */
    public function setPractice($practice)
    {
        $this->practice = $practice;

        return $this;
    }
    /**
     * Gets practice.
     *
     * @return bool
     */
    public function getPractice()
    {
        return $this->practice;
    }
    /**
     * Sets floorSize.
     *
     * @param int $floorSize
     *
     * @return $this
     */
    public function setFloorSize($floorSize)
    {
        $this->floorSize = $floorSize;

        return $this;
    }
    /**
     * Gets floorSize.
     *
     * @return int
     */
    public function getFloorSize()
    {
        return $this->floorSize;
    }
    /**
     * Sets capacity.
     *
     * @param int $capacity
     *
     * @return $this
     */
    public function setCapacity($capacity)
    {
        $this->capacity = $capacity;

        return $this;
    }
    /**
     * Gets capacity.
     *
     * @return int
     */
    public function getCapacity()
    {
        return $this->capacity;
    }
    /**
     * Adds control.
     *
     * @param PlaceControl $control
     *
     * @return $this
     */
    public function addControl(PlaceControl $control)
    {
        $control->setPlace($this);
        $this->controls[] = $control;

        return $this;
    }
    /**
     * Removes control.
     *
     * @param PlaceControl $control
     *
     * @return $this
     */
    public function removeControl(PlaceControl $control)
    {
        $this->controls->removeElement($control);
        return $this;
    }
    /**
     * Gets control.
     *
     * @return ArrayCollection<PlaceControl>
     */
    public function getControls()
    {
        return $this->controls;
    }
    /**
     * Adds repair.
     *
     * @param PlaceRepair $repair
     *
     * @return $this
     */
    public function addRepair(PlaceRepair $repair)
    {
        $repair->setPlace($this);
        $this->repairs[] = $repair;

        return $this;
    }
    /**
     * Removes repair.
     *
     * @param PlaceRepair $repair
     *
     * @return $this
     */
    public function removeRepair(PlaceRepair $repair)
    {
        $this->repairs->removeElement($repair);
        return $this;
    }
    /**
     * Gets repairs.
     *
     * @return ArrayCollection<PlaceRepair>
     */
    public function getRepairs()
    {
        return $this->repairs;
    }
    /**
     * Add course
     *
     * @param \AppBundle\Entity\Booking\Course $course
     *
     * @return Place
     */
    public function addCourse(\AppBundle\Entity\Booking\Course $course)
    {
        $this->courses[] = $course;

        return $this;
    }
    /**
     * Remove course
     *
     * @param \AppBundle\Entity\Booking\Course $course
     */
    public function removeCourse(\AppBundle\Entity\Booking\Course $course)
    {
        $this->courses->removeElement($course);
    }
    /**
     * Get courses
     *
     * @return \Doctrine\Common\Collections\Collection
     */
    public function getCourses()
    {
        return $this->courses;
    }
    /**
     * Add educationalProject
     *
     * @param \AppBundle\Entity\Booking\EducationalProject $educationalProject
     *
     * @return Place
     */
    public function addEducationalProject(\AppBundle\Entity\Booking\EducationalProject $educationalProject)
    {
        $this->educationalProjects[] = $educationalProject;

        return $this;
    }
    /**
     * Remove educationalProject
     *
     * @param \AppBundle\Entity\Booking\EducationalProject $educationalProject
     */
    public function removeEducationalProject(\AppBundle\Entity\Booking\EducationalProject $educationalProject)
    {
        $this->educationalProjects->removeElement($educationalProject);
    }
    /**
     * Get educationalProjects
     *
     * @return \Doctrine\Common\Collections\Collection
     */
    public function getEducationalProjects()
    {
        return $this->educationalProjects;
    }
    /**
     * Add examen
     *
     * @param \AppBundle\Entity\Booking\Examen $examen
     *
     * @return Place
     */
    public function addExamen(\AppBundle\Entity\Booking\Examen $examen)
    {
        $this->examens[] = $examen;

        return $this;
    }
    /**
     * Remove examen
     *
     * @param \AppBundle\Entity\Booking\Examen $examen
     */
    public function removeExamen(\AppBundle\Entity\Booking\Examen $examen)
    {
        $this->examens->removeElement($examen);
    }
    /**
     * Get examens
     *
     * @return \Doctrine\Common\Collections\Collection
     */
    public function getExamens()
    {
        return $this->examens;
    }
    /**
     * Add equipmentStorage
     *
     * @param \AppBundle\Entity\Product\Equipment $equipmentStorage
     *
     * @return Place
     */
    public function addEquipmentStorage(\AppBundle\Entity\Product\Equipment $equipmentStorage)
    {
        $this->equipmentStorages[] = $equipmentStorage;

        return $this;
    }
    /**
     * Remove equipmentStorage
     *
     * @param \AppBundle\Entity\Product\Equipment $equipmentStorage
     */
    public function removeEquipmentStorage(\AppBundle\Entity\Product\Equipment $equipmentStorage)
    {
        $this->equipmentStorages->removeElement($equipmentStorage);
    }
    /**
     * Get equipmentStorages
     *
     * @return \Doctrine\Common\Collections\Collection
     */
    public function getEquipmentStorages()
    {
        return $this->equipmentStorages;
    }
    /**
     * Add equipmentUsed
     *
     * @param \AppBundle\Entity\Product\Equipment $equipmentUsed
     *
     * @return Place
     */
    public function addEquipmentUsed(\AppBundle\Entity\Product\Equipment $equipmentUsed)
    {
        $equipmentUsed->setPlaceWhereIsUsed($this);
        $this->equipmentUseds[] = $equipmentUsed;

        return $this;
    }
    /**
     * Remove equipmentUsed
     *
     * @param \AppBundle\Entity\Product\Equipment $equipmentUsed
     */
    public function removeEquipmentUsed(\AppBundle\Entity\Product\Equipment $equipmentUsed)
    {
        $equipmentUsed->setPlaceWhereIsUsed(null);
        $this->equipmentUseds->removeElement($equipmentUsed);
    }
    /**
     * Get equipmentUseds
     *
     * @return \Doctrine\Common\Collections\Collection
     */
    public function getEquipmentUseds()
    {
        return $this->equipmentUseds;
    }
    /**
     * Sets siretNumber.
     *
     * @param string $siretNumber
     *
     * @return $this
     */
    public function setSiretNumber($siretNumber)
    {
        $this->siretNumber = $siretNumber;

        return $this;
    }
    /**
     * Gets siretNumber.
     *
     * @return string
     */
    public function getSiretNumber()
    {
        return $this->siretNumber;
    }
    /**
     * Add room
     *
     * @param \AppBundle\Entity\Place\Room $room
     *
     * @return Place
     */
    public function addRoom(\AppBundle\Entity\Place\Room $room)
    {
        $room->setPlace($this);
        $this->rooms[] = $room;

        return $this;
    }
    /**
     * Remove room
     *
     * @param \AppBundle\Entity\Place\Room $room
     */
    public function removeRoom(\AppBundle\Entity\Place\Room $room)
    {
        $this->rooms->removeElement($room);
    }
    /**
     * Get rooms
     *
     * @return \Doctrine\Common\Collections\Collection
     */
    public function getRooms()
    {
        return $this->rooms;
    }
}
