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

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

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

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

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

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

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

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


    /**
     * addresses
     *
     * @var \TYPO3\CMS\Extbase\Persistence\ObjectStorage<\Medienreaktor\Persons\Domain\Model\Address>
     */
    #[\TYPO3\CMS\Extbase\Annotation\ORM\Cascade(['value' => 'remove'])]
    protected $addresses = null;

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

    /**
     * __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->company = new \TYPO3\CMS\Extbase\Persistence\ObjectStorage();
        $this->addresses = new \TYPO3\CMS\Extbase\Persistence\ObjectStorage();
    }

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

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

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

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

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

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

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

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

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

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

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

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


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

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


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

}
