<?php
namespace Medienreaktor\Persons\Domain\Model;

/***
 *
 * This file is part of the "Persons" Extension for TYPO3 CMS.
 *
 * For the full copyright and license information, please read the
 * LICENSE.txt file that was distributed with this source code.
 *
 *  (c) 2018
 *
 ***/

/**
 * Location
 */
class Location extends \TYPO3\CMS\Extbase\DomainObject\AbstractEntity
{
    /**
     * title
     *
     * @var string
     */
    protected $title = '';

    /**
     * description
     *
     * @var string
     */
    protected $description = '';

    /**
     * image
     *
     * @var \TYPO3\CMS\Extbase\Domain\Model\FileReference
     */
    #[\TYPO3\CMS\Extbase\Annotation\ORM\Cascade(['value' => 'remove'])]
    protected $image = null;

    /**
     * addresses
     *
     * @var \TYPO3\CMS\Extbase\Persistence\ObjectStorage<\Medienreaktor\Persons\Domain\Model\Address>
     */
    protected $addresses = null;

    /**
     * companys
     *
     * @var \TYPO3\CMS\Extbase\Persistence\ObjectStorage<\Medienreaktor\Persons\Domain\Model\Company>
     */
    protected $companys = null;

    /**
     * detailpid
     *
     * @var string
     */
    protected $detailpid = '';

    /**
     * __construct
     */
    public function __construct()
    {
        //Do not remove the next line: It would break the functionality
        $this->initStorageObjects();
    }

    /**
     * Initializes all ObjectStorage properties
     * Do not modify this method!
     * It will be rewritten on each save in the extension builder
     * You may modify the constructor of this class instead
     *
     * @return void
     */
    protected function initStorageObjects()
    {
        $this->addresses = new \TYPO3\CMS\Extbase\Persistence\ObjectStorage();
        $this->companys = new \TYPO3\CMS\Extbase\Persistence\ObjectStorage();
    }

    /**
     * Returns the title
     *
     * @return string $title
     */
    public function getTitle()
    {
        return $this->title;
    }

    /**
     * Sets the title
     *
     * @param string $title
     * @return void
     */
    public function setTitle($title): void
    {
        $this->title = $title;
    }

    /**
     * Returns the description
     *
     * @return string $description
     */
    public function getDescription()
    {
        return $this->description;
    }

    /**
     * Sets the description
     *
     * @param string $description
     * @return void
     */
    public function setDescription($description): void
    {
        $this->description = $description;
    }

    /**
     * Returns the detailpid
     *
     * @return string $detailpid
     */
    public function getDetailpid()
    {
        return $this->detailpid;
    }

    /**
     * Sets the detailpid
     *
     * @param string $detailpid
     * @return void
     */
    public function setDetailpid($detailpid): void
    {
        $this->detailpid = $detailpid;
    }

    /**
     * Returns the image
     *
     * @return \TYPO3\CMS\Extbase\Domain\Model\FileReference $image
     */
    public function getImage()
    {
        return $this->image;
    }

    /**
     * Sets the image
     *
     * @param \TYPO3\CMS\Extbase\Domain\Model\FileReference $image
     * @return void
     */
    public function setImage(\TYPO3\CMS\Extbase\Domain\Model\FileReference $image): void
    {
        $this->image = $image;
    }

    /**
     * Adds a
     *
     * @param \Medienreaktor\Persons\Domain\Model\Address $address
     * @return void
     */
    public function addAddress($address): void
    {
        $this->addresses->attach($address);
    }

    /**
     * Removes a
     *
     * @param \Medienreaktor\Persons\Domain\Model\Address $addressToRemove The Address to be removed
     * @return void
     */
    public function removeAddress($addressToRemove): void
    {
        $this->addresses->detach($addressToRemove);
    }

    /**
     * Returns the addresses
     *
     * @return \TYPO3\CMS\Extbase\Persistence\ObjectStorage<\Medienreaktor\Persons\Domain\Model\Address> addresses
     */
    public function getAddresses()
    {
        return $this->addresses;
    }

    /**
     * Sets the addresses
     *
     * @param \TYPO3\CMS\Extbase\Persistence\ObjectStorage<\Medienreaktor\Persons\Domain\Model\Address> $addresses
     * @return void
     */
    public function setAddresses(\TYPO3\CMS\Extbase\Persistence\ObjectStorage $addresses): void
    {
        $this->addresses = $addresses;
    }

    /**
     * Adds a Company
     *
     * @param \Medienreaktor\Persons\Domain\Model\Company $company
     * @return void
     */
    public function addCompany($company): void
    {
        $this->companys->attach($company);
    }

    /**
     * Removes a Company
     *
     * @param \Medienreaktor\Persons\Domain\Model\Company $companyToRemove The Company to be removed
     * @return void
     */
    public function removeCompany($companyToRemove): void
    {
        $this->companys->detach($companyToRemove);
    }

    /**
     * Returns the companys
     *
     * @return \TYPO3\CMS\Extbase\Persistence\ObjectStorage<\Medienreaktor\Persons\Domain\Model\Company> companys
     */
    public function getCompanys()
    {
        return $this->companys;
    }

    /**
     * Sets the companys
     *
     * @param \TYPO3\CMS\Extbase\Persistence\ObjectStorage<\Medienreaktor\Persons\Domain\Model\Company> $companys
     * @return void
     */
    public function setCompanys(\TYPO3\CMS\Extbase\Persistence\ObjectStorage $companys): void
    {
        $this->companys = $companys;
    }
}
