<?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
 *
 ***/

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

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

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


    /**
     * 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->company = 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;
    }

    /**
     * Adds a Company
     *
     * @param \Medienreaktor\Persons\Domain\Model\Company $company
     * @return void
     */
    public function addCompany($company): void
    {
        $this->company->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->company->detach($companyToRemove);
    }

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

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

}
