<?php

namespace RxConnexionBundle\Entity;

use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\ORM\Mapping as ORM;
use RxConnexionBundle\Entity\Base\BaseEntity;

/**
 * @ORM\Entity(repositoryClass="RxConnexionBundle\Repository\UserRepository")
 * @ORM\Table(name="user")
 */
 
class UserEntity extends BaseEntity
{
    /**
     * @ORM\Column(type="string", length=50)
     */
	protected $username;
	
    /**
     * @ORM\Column(type="string", length=100)
     */
	protected $password;

    /**
     * @ORM\Column(type="string")
     */
    protected $type;
		
    /**
     * @ORM\Column(name="is_active", type="boolean")
     */
	protected $isActive=0;

    /**
     * @ORM\Column(name="first_name", type="string", length=50)
     */
	protected $firstName;	

    /**
     * @ORM\Column(name="middle_name", type="string", length=50, nullable = true)
     */
	protected $middleName;

    /**
     * @ORM\Column(name="last_name", type="string", length=50)
     */
	protected $lastName;

    /**
     * @ORM\Column(name="is_deleted", type="boolean")
     */
    protected $isDeleted;

    /**
     * @ORM\Column(name="full_name", type="string", length=100, nullable=true)
     */
	protected $fullName;

    /**
     * @ORM\OneToMany(targetEntity="AccountUserReminderEntity", mappedBy="user", cascade={"remove"})
     */
    protected $accountUserReminders;

//    /**
//     * @ORM\OneToMany(targetEntity="RxConnexionBundle\Entity\TransferInventoryEntity", mappedBy="user", cascade={"remove"})
//     */
//    protected $transferInventories;

    /** 
     * Set createdAt 
     * 
     * @ORM\PrePersist 
     */      
    public function setCreatedAtValue()  
    {
        parent::setCreatedAtValue();
		$this->fullName = ucfirst($this->firstName) . ' ' . ucfirst($this->lastName);
		$this->isDeleted = 0;
    }    
  
    /** 
     * Set updatedAt 
     * 
     * @ORM\PreUpdate 
     */  
    public function setUpdatedAtValue()  
    {
        parent::setUpdatedAtValue();
		$this->fullName = ucfirst($this->firstName) . ' ' . ucfirst($this->lastName);
    }

    public function __construct()
    {
        $this->accountUserReminders = new ArrayCollection();
//        $this->transferInventories = new ArrayCollection();
    }

	/*--------------------------------------------------------------------------------------------------------*/
	/*					User Defined setters and Getters													  */
	/*--------------------------------------------------------------------------------------------------------*/
    
	/*--------------------------------------------------------------------------------------------------------*/
	/*					Setters and Getters																	  */
	/*--------------------------------------------------------------------------------------------------------*/

    /**
     * Set username
     *
     * @param string $username
     *
     * @return UserEntity
     */
    public function setUsername($username)
    {
        $this->username = $username;

        return $this;
    }

    /**
     * Get username
     *
     * @return string
     */
    public function getUsername()
    {
        return $this->username;
    }

    /**
     * Set password
     *
     * @param string $password
     *
     * @return UserEntity
     */
    public function setPassword($password)
    {
        $this->password = $password;

        return $this;
    }

    /**
     * Get password
     *
     * @return string
     */
    public function getPassword()
    {
        return $this->password;
    }

    /**
     * Set type
     *
     * @param string $type
     *
     * @return UserEntity
     */
    public function setType($type)
    {
        $this->type = $type;

        return $this;
    }

    /**
     * Get type
     *
     * @return string
     */
    public function getType()
    {
        return $this->type;
    }

    /**
     * Set isActive
     *
     * @param boolean $isActive
     *
     * @return UserEntity
     */
    public function setIsActive($isActive)
    {
        $this->isActive = $isActive;

        return $this;
    }

    /**
     * Get isActive
     *
     * @return boolean
     */
    public function getIsActive()
    {
        return $this->isActive;
    }

    /**
     * Set firstName
     *
     * @param string $firstName
     *
     * @return UserEntity
     */
    public function setFirstName($firstName)
    {
        $this->firstName = $firstName;

        return $this;
    }

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

    /**
     * Set middleName
     *
     * @param string $middleName
     *
     * @return UserEntity
     */
    public function setMiddleName($middleName)
    {
        $this->middleName = $middleName;

        return $this;
    }

    /**
     * Get middleName
     *
     * @return string
     */
    public function getMiddleName()
    {
        return $this->middleName;
    }

    /**
     * Set lastName
     *
     * @param string $lastName
     *
     * @return UserEntity
     */
    public function setLastName($lastName)
    {
        $this->lastName = $lastName;

        return $this;
    }

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

    /**
     * Set fullName
     *
     * @param string $fullName
     *
     * @return UserEntity
     */
    public function setFullName($fullName)
    {
        $this->fullName = $fullName;

        return $this;
    }

    /**
     * Get fullName
     *
     * @return string
     */
    public function getFullName()
    {
        return $this->fullName;
    }

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

    /**
     * Set createdBy
     *
     * @param string $createdBy
     *
     * @return UserEntity
     */
    public function setCreatedBy($createdBy)
    {
        $this->createdBy = $createdBy;

        return $this;
    }

    /**
     * Get createdBy
     *
     * @return string
     */
    public function getCreatedBy()
    {
        return $this->createdBy;
    }

    /**
     * Set createdAt
     *
     * @param \DateTime $createdAt
     *
     * @return UserEntity
     */
    public function setCreatedAt($createdAt)
    {
        $this->createdAt = $createdAt;

        return $this;
    }

    /**
     * Get createdAt
     *
     * @return \DateTime
     */
    public function getCreatedAt()
    {
        return $this->createdAt;
    }

    /**
     * Set updatedBy
     *
     * @param string $updatedBy
     *
     * @return UserEntity
     */
    public function setUpdatedBy($updatedBy)
    {
        $this->updatedBy = $updatedBy;

        return $this;
    }

    /**
     * Get updatedBy
     *
     * @return string
     */
    public function getUpdatedBy()
    {
        return $this->updatedBy;
    }

    /**
     * Set updatedAt
     *
     * @param \DateTime $updatedAt
     *
     * @return UserEntity
     */
    public function setUpdatedAt($updatedAt)
    {
        $this->updatedAt = $updatedAt;

        return $this;
    }

    /**
     * Get updatedAt
     *
     * @return \DateTime
     */
    public function getUpdatedAt()
    {
        return $this->updatedAt;
    }

    /**
     * Set isDeleted
     *
     * @param boolean $isDeleted
     *
     * @return UserEntity
     */
    public function setIsDeleted($isDeleted)
    {
        $this->isDeleted = $isDeleted;

        return $this;
    }

    /**
     * Get isDeleted
     *
     * @return boolean
     */
    public function getIsDeleted()
    {
        return $this->isDeleted;
    }

    /**
     * Add accountUserReminder
     *
     * @param \RxConnexionBundle\Entity\AccountUserReminderEntity $accountUserReminder
     *
     * @return UserEntity
     */
    public function addAccountUserReminder(\RxConnexionBundle\Entity\AccountUserReminderEntity $accountUserReminder)
    {
        $this->accountUserReminders[] = $accountUserReminder;

        return $this;
    }

    /**
     * Remove accountUserReminder
     *
     * @param \RxConnexionBundle\Entity\AccountUserReminderEntity $accountUserReminder
     */
    public function removeAccountUserReminder(\RxConnexionBundle\Entity\AccountUserReminderEntity $accountUserReminder)
    {
        $this->accountUserReminders->removeElement($accountUserReminder);
    }

    /**
     * Get accountUserReminders
     *
     * @return \Doctrine\Common\Collections\Collection
     */
    public function getAccountUserReminders()
    {
        return $this->accountUserReminders;
    }

    /**
     * Add transferInventory
     *
     * @param \RxConnexionBundle\Entity\TransferInventoryEntity $transferInventory
     *
     * @return UserEntity
     */
    public function addTransferInventory(\RxConnexionBundle\Entity\TransferInventoryEntity $transferInventory)
    {
        $this->transferInventories[] = $transferInventory;

        return $this;
    }

    /**
     * Remove transferInventory
     *
     * @param \RxConnexionBundle\Entity\TransferInventoryEntity $transferInventory
     */
    public function removeTransferInventory(\RxConnexionBundle\Entity\TransferInventoryEntity $transferInventory)
    {
        $this->transferInventories->removeElement($transferInventory);
    }

    /**
     * Get transferInventories
     *
     * @return \Doctrine\Common\Collections\Collection
     */
    public function getTransferInventories()
    {
        return $this->transferInventories;
    }
}
