<?php
namespace Opentalent\OtCore\Domain\Model;

use TYPO3\CMS\Extbase\DomainObject\AbstractEntity;

/**
 * Member of an organization
 */
class Member extends AbstractEntity
{
    /**
     * id
     *
     * @var int
     */
    protected $id = -1;

    /**
     * organizationId
     *
     * @var int
     */
    protected $organizationId = -1;

    /**
     * gender ('MISS' or 'MISTER')
     *
     * @var string
     */
    protected $gender = '';

    /**
     * givenName (first name)
     *
     * @var string
     */
    protected $givenName = '';

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

    /**
     * startDate
     *
     * @var \Datetime
     */
    protected $startDate = null;

    /**
     * endDate
     *
     * @var \Datetime
     */
    protected $endDate = null;

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

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

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

    /**
     * personId
     *
     * @var string
     */
    protected $personId = -1;

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

    /**
     * @return int
     */
    public function getId(): int
    {
        return $this->id;
    }

    /**
     * @param int $id
     */
    public function setId(int $id)
    {
        $this->id = $id;
    }

    /**
     * @return int
     */
    public function getOrganizationId(): int
    {
        return $this->organizationId;
    }

    /**
     * @param int $organizationId
     */
    public function setOrganizationId(int $organizationId)
    {
        $this->organizationId = $organizationId;
    }

    /**
     * @return string
     */
    public function getGender(): ?string
    {
        return $this->gender;
    }

    /**
     * @param string|null $gender
     */
    public function setGender(?string $gender)
    {
        $this->gender = $gender;
    }

    /**
     * @return string
     */
    public function getGivenName(): ?string
    {
        return $this->givenName;
    }

    /**
     * @param string|null $givenName
     */
    public function setGivenName(?string $givenName)
    {
        $this->givenName = $givenName;
    }

    /**
     * @return string
     */
    public function getName(): ?string
    {
        return $this->name;
    }

    /**
     * @param string|null $name
     */
    public function setName(?string $name)
    {
        $this->name = $name;
    }

    /**
     * @return \Datetime
     */
    public function getStartDate(): ?\DateTime
    {
        return $this->startDate;
    }

    /**
     * @param \Datetime|null $startDate
     */
    public function setStartDate(?\Datetime $startDate)
    {
        $this->startDate = $startDate;
    }

    /**
     * @return \Datetime
     */
    public function getEndDate(): ?\DateTime
    {
        return $this->endDate;
    }

    /**
     * @param \Datetime|null $endDate
     */
    public function setEndDate(?\Datetime $endDate)
    {
        $this->endDate = $endDate;
    }

    /**
     * @return string
     */
    public function getInstrumentGroup(): ?string
    {
        return $this->instrumentGroup;
    }

    /**
     * @param string|null $instrumentGroup
     */
    public function setInstrumentGroup(?string $instrumentGroup)
    {
        $this->instrumentGroup = $instrumentGroup;
    }

    /**
     * @return string
     */
    public function getInstrument(): ?string
    {
        return $this->instrument;
    }

    /**
     * @param string|null $instrument
     */
    public function setInstrument(?string $instrument)
    {
        $this->instrument = $instrument;
    }

    /**
     * @return string
     */
    public function getMission(): ?string
    {
        return $this->mission;
    }

    /**
     * @param string|null $mission
     */
    public function setMission(?string $mission)
    {
        $this->mission = $mission;
    }

    /**
     * @return int
     */
    public function getPersonId(): int
    {
        return $this->personId;
    }

    /**
     * @param int $personId
     */
    public function setPersonId(int $personId)
    {
        $this->personId = $personId;
    }

    /**
     * @return string
     */
    public function getImage(): ?string
    {
        return $this->image;
    }

    /**
     * @param string|null $image
     */
    public function setImage(?string $image)
    {
        $this->image = $image;
    }

    /**
     * Return a full name for the member
     *
     * @return string
     */
    public function getFullName(): string
    {
        if ($this->getGivenName() && $this->getName()) {
            return $this->getGivenName() . ' ' . $this->getName();
        } else if ($this->getName()) {
            return 'M. ' . $this->getName();
        } else {
            return '';
        }
    }

}
