<?php

namespace RxConnexionBundle\Entity;

use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\ORM\Mapping as ORM;
use RxConnexionBundle\Entity\Base\BaseEntity;
use JMS\Serializer\Annotation\Groups;
use JMS\Serializer\Annotation\MaxDepth;

/**
 * @ORM\Entity(repositoryClass="RxConnexionBundle\Repository\AccountUserRepository")
 * @ORM\Table(name="account_user")
 */

class AccountUserEntity extends BaseEntity
{

    /**
     * @ORM\Column(type="string", length=50)
     * @Groups("forAudit")
     */
    protected $username;

    /**
     * @ORM\Column(type="string")
     */
    protected $password;

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

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

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

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

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

    /**
     * @ORM\Column(name="old_sys_id", type="string", nullable=true)
     * @Groups("forAudit")
     */
    protected $oldSysId;

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

    /**
     * @ORM\ManyToOne(targetEntity="AccountUserTypeEntity", inversedBy="users")
     * @ORM\JoinColumn(name="account_user_type_id", referencedColumnName="id")
     * @Groups("forAudit")
     * @MaxDepth(1)
     */
    protected $accountUserType;

    /**
     * @ORM\ManyToOne(targetEntity="SalesAgentEntity", inversedBy="accountUsers")
     * @ORM\JoinColumn(name="sales_agent_id", referencedColumnName="id")
     * @Groups("forAudit")
     */
    protected $salesAgent;

    /**
     * @ORM\ManyToOne(targetEntity="AccountStaffEntity", inversedBy="accountUsers")
     * @ORM\JoinColumn(name="account_staff_id", referencedColumnName="id")
     * @Groups("forAudit")
     */
    protected $accountStaff;

    /**
     * @ORM\ManyToOne(targetEntity="AccountUserBillingEntity", inversedBy="accountUsers")
     * @ORM\JoinColumn(name="account_user_billing_id", referencedColumnName="id")
     * @Groups("forAudit")
     */
    protected $accountUserBilling;

    /**
     * @ORM\ManyToOne(targetEntity="ProviderEntity", inversedBy="accountUsers")
     * @ORM\JoinColumn(name="provider_id", referencedColumnName="id")
     * @Groups("forAudit")
     */
    protected $provider;

    /**
     * @ORM\OneToMany(targetEntity="AccountUserCompanyEntity", mappedBy="accountUser")
     */
    protected $companies;

    /**
     * @ORM\OneToMany(targetEntity="FaxTranEntity", mappedBy="accountUser")
     */
    protected $faxTrans;

    /**
     * @ORM\OneToMany(targetEntity="AccountUserBranchEntity", mappedBy="accountUser")
     */
    protected $branches;

    /**
     * @ORM\OneToMany(targetEntity="AccountUserLocationEntity", mappedBy="accountUser")
     */
    protected $locations;

    /**
     * @ORM\OneToMany(targetEntity="PatientChartEntity", mappedBy="accountUserMoaAssignment")
     */
    protected $moaAssignmentPatientCharts;

    /**
     * @ORM\OneToMany(targetEntity="AccountUserHealthFacilityEntity", mappedBy="accountUser")
     */
    protected $accountUserHealthFacilities;

    /**
     * @ORM\OneToMany(targetEntity="ChatParticipantEntity", mappedBy="accountUser")
     */
    protected $chatParticipants;

    /**
     * @ORM\OneToMany(targetEntity="ChatEntity", mappedBy="accountUser")
     */
    protected $chats;

    /**
     * @ORM\OneToMany(targetEntity="TicketEntity", mappedBy="accountUser")
     */
    protected $tickets;

    /**
     * @ORM\OneToMany(targetEntity="AccountUserOtherAccessEntity", mappedBy="accountUser", cascade={"remove"})
     */
    protected $accountUserOtherAccesses;

    /**
     * @ORM\OneToMany(targetEntity="PatientLetterEntity", mappedBy="accountUser", cascade={"remove"})
     */
    protected $patientLetters;

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

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

    /**
     * @ORM\OneToMany(targetEntity="UserGroupAccountUserEntity", mappedBy="accountUser", cascade={"remove"})
     */
    protected $userGroupAccountUsers;

    /**
     * @ORM\OneToMany(targetEntity="TicketCcEntity", mappedBy="accountUser", cascade={"remove"})
     */
    protected $ticketCcs;

    /**
     * @ORM\OneToMany(targetEntity="RxConnexionBundle\Entity\RxApiSessionEntity", mappedBy="accountUser", cascade={"remove"})
     */
    protected $rxApiSessions;

    /**
     * @ORM\OneToMany(targetEntity="LoginTrackerEntity", mappedBy="accountUser", cascade={"remove"})
     */
    protected $loginTrackers;

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

    /**
     * @ORM\OneToMany(targetEntity="PatientChartCcEntity", mappedBy="patientChart")
     */
    protected $patientChartCcs;


    public function __construct()
    {
        $this->companies = new ArrayCollection();
        $this->branches = new ArrayCollection();
        $this->locations = new ArrayCollection();
        $this->faxTrans = new ArrayCollection();
        $this->moaAssignmentPatientCharts = new ArrayCollection();
        $this->accountUserHealthFacilities = new ArrayCollection();
        $this->tickets = new ArrayCollection();
        $this->chats = new ArrayCollection();
        $this->chatParticipants = new ArrayCollection();
        $this->accountUserOtherAccesses = new ArrayCollection();
        $this->patientLetters = new ArrayCollection();
        $this->accountUserReminders = new ArrayCollection();
        $this->assignedToAccountUserReminders = new ArrayCollection();
        $this->userGroupAccountUsers = new ArrayCollection();
        $this->ticketCcs = new ArrayCollection();
        $this->transferInventories = new ArrayCollection();
        $this->patientChartCcs = new ArrayCollection();
    }

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

    /*--------------------------------------------------------------------------------------------------------*/
    /*					AccountUser Defined setters and Getters												  */
    /*--------------------------------------------------------------------------------------------------------*/

    /**
     * Get hasCompany
     *
     * @param \RxConnexionBundle\Entity\CompanyEntity $company
     * @return boolean
     */
    public function getHasCompany(\RxConnexionBundle\Entity\CompanyEntity $company=null) {

        $hasCompany = false;

        foreach($this->companies as $company_obj) {
            if($company_obj->getCompany() === $company) $hasCompany = true;
        }

        return $hasCompany;
    }

    /**
     * Get hasBranch
     *
     * @param \RxConnexionBundle\Entity\BranchEntity $branch
     * @return boolean
     */
    public function getHasBranch(\RxConnexionBundle\Entity\BranchEntity $branch=null) {

        $hasBranch = false;

        foreach($this->branches as $branch_obj) {
            if($branch_obj->getBranch() === $branch) $hasBranch = true;
        }

        return $hasBranch;
    }

    /**
     * Get hasLocation
     *
     * @param \RxConnexionBundle\Entity\LocationEntity $location
     * @return boolean
     */
    public function getHasLocation(\RxConnexionBundle\Entity\LocationEntity $location=null) {

        $hasLocation = false;

        foreach($this->locations as $location_obj) {
            if($location_obj->getLocation() === $location) $hasLocation = true;
        }

        return $hasLocation;
    }

    /**
     * Get userOtherAccessesByType
     *
     * @param string $type
     * @return array
     */
    public function getUserOtherAccessesByType($type) {

        $userOtherAccesses = array();

        foreach($this->accountUserOtherAccesses as $userOtherAccess_obj) {
            if($userOtherAccess_obj->getType() === $type) {
                $userOtherAccesses[] = $userOtherAccess_obj;
            }
        }

        return $userOtherAccesses;
    }



    /**
     * Get activeHealthFacilityIdsAsArray
     *
     * @return array
     */
    public function getActiveHealthFacilityIdsAsArray() {

        $ids = array();

        $dt = strtotime(date('m/d/Y'));
        foreach($this->accountUserHealthFacilities as $accountUserHealthFacility) {
            $sDT = $accountUserHealthFacility->getStartDateAsTime();
            $eDT = $accountUserHealthFacility->getEndDateAsTime();
            if($dt >= $sDT && ($eDT === 0 || $eDT >= $dt)) {
                $ids[] = $accountUserHealthFacility->getHealthFacility()->getId();
            }
        }

        return $ids;
    }

    /**
     * Get activeHealthFacilityIdsAsArray
     *
     * @return array
     */
    public function getActiveCompanyIdsAsArray() {

        $ids = array();

        $dt = strtotime(date('m/d/Y'));
        foreach($this->companies as $accountUserCompanies) {
            $sDT = $accountUserCompanies->getStartDateAsTime();
            $eDT = $accountUserCompanies->getEndDateAsTime();
            if($dt >= $sDT && ($eDT === 0 || $eDT >= $dt)) {
                $ids[] = $accountUserCompanies->getCompany()->getId();
            }
        }

        return $ids;
    }

    /**
     * Get userGroupIdsAsArray
     *
     * @return array
     */
    public function getUserGroupIdsAsArray() {
        $data = array();

        foreach($this->userGroupAccountUsers as $userGroupAccountUser) {
            $data[] = $userGroupAccountUser->getUserGroup()->getId();
        }

        return $data;
    }



    /*--------------------------------------------------------------------------------------------------------*/
    /*					Setters and Getters																	  */
    /*--------------------------------------------------------------------------------------------------------*/


    /**
     * Set username
     *
     * @param string $username
     *
     * @return AccountUserEntity
     */
    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 AccountUserEntity
     */
    public function setPassword($password)
    {
        $this->password = $password;

        return $this;
    }

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

    /**
     * Set isActive
     *
     * @param boolean $isActive
     *
     * @return AccountUserEntity
     */
    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 AccountUserEntity
     */
    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 AccountUserEntity
     */
    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 AccountUserEntity
     */
    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 AccountUserEntity
     */
    public function setFullName($fullName)
    {
        $this->fullName = $fullName;

        return $this;
    }

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

    /**
     * Set accountUserType
     *
     * @param \RxConnexionBundle\Entity\AccountUserTypeEntity $accountUserType
     *
     * @return AccountUserEntity
     */
    public function setAccountUserType(\RxConnexionBundle\Entity\AccountUserTypeEntity $accountUserType = null)
    {
        $this->accountUserType = $accountUserType;

        return $this;
    }

    /**
     * Get accountUserType
     *
     * @return \RxConnexionBundle\Entity\AccountUserTypeEntity
     */
    public function getAccountUserType()
    {
        return $this->accountUserType;
    }

    /**
     * Add company
     *
     * @param \RxConnexionBundle\Entity\AccountUserCompanyEntity $company
     *
     * @return AccountUserEntity
     */
    public function addCompany(\RxConnexionBundle\Entity\AccountUserCompanyEntity $company)
    {
        $this->companies[] = $company;

        return $this;
    }

    /**
     * Remove company
     *
     * @param \RxConnexionBundle\Entity\AccountUserCompanyEntity $company
     */
    public function removeCompany(\RxConnexionBundle\Entity\AccountUserCompanyEntity $company)
    {
        $this->companies->removeElement($company);
    }

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

    /**
     * Add branch
     *
     * @param \RxConnexionBundle\Entity\AccountUserBranchEntity $branch
     *
     * @return AccountUserEntity
     */
    public function addBranch(\RxConnexionBundle\Entity\AccountUserBranchEntity $branch)
    {
        $this->branches[] = $branch;

        return $this;
    }

    /**
     * Remove branch
     *
     * @param \RxConnexionBundle\Entity\AccountUserBranchEntity $branch
     */
    public function removeBranch(\RxConnexionBundle\Entity\AccountUserBranchEntity $branch)
    {
        $this->branches->removeElement($branch);
    }

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

    /**
     * Add location
     *
     * @param \RxConnexionBundle\Entity\AccountUserLocationEntity $location
     *
     * @return AccountUserEntity
     */
    public function addLocation(\RxConnexionBundle\Entity\AccountUserLocationEntity $location)
    {
        $this->locations[] = $location;

        return $this;
    }

    /**
     * Remove location
     *
     * @param \RxConnexionBundle\Entity\AccountUserLocationEntity $location
     */
    public function removeLocation(\RxConnexionBundle\Entity\AccountUserLocationEntity $location)
    {
        $this->locations->removeElement($location);
    }

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

    /**
     * Set oldSysId
     *
     * @param string $oldSysId
     *
     * @return AccountUserEntity
     */
    public function setOldSysId($oldSysId)
    {
        $this->oldSysId = $oldSysId;

        return $this;
    }

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

    /**
     * Set provider
     *
     * @param \RxConnexionBundle\Entity\ProviderEntity $provider
     *
     * @return AccountUserEntity
     */
    public function setProvider(\RxConnexionBundle\Entity\ProviderEntity $provider = null)
    {
        $this->provider = $provider;

        return $this;
    }

    /**
     * Get provider
     *
     * @return \RxConnexionBundle\Entity\ProviderEntity
     */
    public function getProvider()
    {
        return $this->provider;
    }

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

    /**
     * Set createdBy
     *
     * @param string $createdBy
     *
     * @return AccountUserEntity
     */
    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 AccountUserEntity
     */
    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 AccountUserEntity
     */
    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 AccountUserEntity
     */
    public function setUpdatedAt($updatedAt)
    {
        $this->updatedAt = $updatedAt;

        return $this;
    }

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

    /**
     * Add faxTran
     *
     * @param \RxConnexionBundle\Entity\FaxTranEntity $faxTran
     *
     * @return AccountUserEntity
     */
    public function addFaxTran(\RxConnexionBundle\Entity\FaxTranEntity $faxTran)
    {
        $this->faxTrans[] = $faxTran;

        return $this;
    }

    /**
     * Remove faxTran
     *
     * @param \RxConnexionBundle\Entity\FaxTranEntity $faxTran
     */
    public function removeFaxTran(\RxConnexionBundle\Entity\FaxTranEntity $faxTran)
    {
        $this->faxTrans->removeElement($faxTran);
    }

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

    /**
     * Add moaAssignmentPatientChart
     *
     * @param \RxConnexionBundle\Entity\PatientChartEntity $moaAssignmentPatientChart
     *
     * @return AccountUserEntity
     */
    public function addMoaAssignmentPatientChart(\RxConnexionBundle\Entity\PatientChartEntity $moaAssignmentPatientChart)
    {
        $this->moaAssignmentPatientCharts[] = $moaAssignmentPatientChart;

        return $this;
    }

    /**
     * Remove moaAssignmentPatientChart
     *
     * @param \RxConnexionBundle\Entity\PatientChartEntity $moaAssignmentPatientChart
     */
    public function removeMoaAssignmentPatientChart(\RxConnexionBundle\Entity\PatientChartEntity $moaAssignmentPatientChart)
    {
        $this->moaAssignmentPatientCharts->removeElement($moaAssignmentPatientChart);
    }

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

    /**
     * Set salesAgent
     *
     * @param \RxConnexionBundle\Entity\SalesAgentEntity $salesAgent
     *
     * @return AccountUserEntity
     */
    public function setSalesAgent(\RxConnexionBundle\Entity\SalesAgentEntity $salesAgent = null)
    {
        $this->salesAgent = $salesAgent;

        return $this;
    }

    /**
     * Get salesAgent
     *
     * @return \RxConnexionBundle\Entity\SalesAgentEntity
     */
    public function getSalesAgent()
    {
        return $this->salesAgent;
    }

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

        return $this;
    }

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

    /**
     * Set accountStaff
     *
     * @param \RxConnexionBundle\Entity\AccountStaffEntity $accountStaff
     *
     * @return AccountUserEntity
     */
    public function setAccountStaff(\RxConnexionBundle\Entity\AccountStaffEntity $accountStaff = null)
    {
        $this->accountStaff = $accountStaff;

        return $this;
    }

    /**
     * Get accountStaff
     *
     * @return \RxConnexionBundle\Entity\AccountStaffEntity
     */
    public function getAccountStaff()
    {
        return $this->accountStaff;
    }

    /**
     * Add accountUserHealthFacility
     *
     * @param \RxConnexionBundle\Entity\AccountUserHealthFacilityEntity $accountUserHealthFacility
     *
     * @return AccountUserEntity
     */
    public function addAccountUserHealthFacility(\RxConnexionBundle\Entity\AccountUserHealthFacilityEntity $accountUserHealthFacility)
    {
        $this->accountUserHealthFacilities[] = $accountUserHealthFacility;

        return $this;
    }

    /**
     * Remove accountUserHealthFacility
     *
     * @param \RxConnexionBundle\Entity\AccountUserHealthFacilityEntity $accountUserHealthFacility
     */
    public function removeAccountUserHealthFacility(\RxConnexionBundle\Entity\AccountUserHealthFacilityEntity $accountUserHealthFacility)
    {
        $this->accountUserHealthFacilities->removeElement($accountUserHealthFacility);
    }

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

    /**
     * Add ticket
     *
     * @param \RxConnexionBundle\Entity\TicketEntity $ticket
     *
     * @return AccountUserEntity
     */
    public function addTicket(\RxConnexionBundle\Entity\TicketEntity $ticket)
    {
        $this->tickets[] = $ticket;

        return $this;
    }

    /**
     * Remove ticket
     *
     * @param \RxConnexionBundle\Entity\TicketEntity $ticket
     */
    public function removeTicket(\RxConnexionBundle\Entity\TicketEntity $ticket)
    {
        $this->tickets->removeElement($ticket);
    }

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

    /**
     * Add chatParticipant
     *
     * @param \RxConnexionBundle\Entity\ChatParticipantEntity $chatParticipant
     *
     * @return AccountUserEntity
     */
    public function addChatParticipant(\RxConnexionBundle\Entity\ChatParticipantEntity $chatParticipant)
    {
        $this->chatParticipants[] = $chatParticipant;

        return $this;
    }

    /**
     * Remove chatParticipant
     *
     * @param \RxConnexionBundle\Entity\ChatParticipantEntity $chatParticipant
     */
    public function removeChatParticipant(\RxConnexionBundle\Entity\ChatParticipantEntity $chatParticipant)
    {
        $this->chatParticipants->removeElement($chatParticipant);
    }

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

    /**
     * Add chat
     *
     * @param \RxConnexionBundle\Entity\ChatEntity $chat
     *
     * @return AccountUserEntity
     */
    public function addChat(\RxConnexionBundle\Entity\ChatEntity $chat)
    {
        $this->chats[] = $chat;

        return $this;
    }

    /**
     * Remove chat
     *
     * @param \RxConnexionBundle\Entity\ChatEntity $chat
     */
    public function removeChat(\RxConnexionBundle\Entity\ChatEntity $chat)
    {
        $this->chats->removeElement($chat);
    }

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

    /**
     * Add accountUserOtherAccess
     *
     * @param \RxConnexionBundle\Entity\AccountUserOtherAccessEntity $accountUserOtherAccess
     *
     * @return AccountUserEntity
     */
    public function addAccountUserOtherAccess(\RxConnexionBundle\Entity\AccountUserOtherAccessEntity $accountUserOtherAccess)
    {
        $this->accountUserOtherAccesses[] = $accountUserOtherAccess;

        return $this;
    }

    /**
     * Remove accountUserOtherAccess
     *
     * @param \RxConnexionBundle\Entity\AccountUserOtherAccessEntity $accountUserOtherAccess
     */
    public function removeAccountUserOtherAccess(\RxConnexionBundle\Entity\AccountUserOtherAccessEntity $accountUserOtherAccess)
    {
        $this->accountUserOtherAccesses->removeElement($accountUserOtherAccess);
    }

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

    /**
     * Add patientLetter
     *
     * @param \RxConnexionBundle\Entity\PatientLetterEntity $patientLetter
     *
     * @return AccountUserEntity
     */
    public function addPatientLetter(\RxConnexionBundle\Entity\PatientLetterEntity $patientLetter)
    {
        $this->patientLetters[] = $patientLetter;

        return $this;
    }

    /**
     * Remove patientLetter
     *
     * @param \RxConnexionBundle\Entity\PatientLetterEntity $patientLetter
     */
    public function removePatientLetter(\RxConnexionBundle\Entity\PatientLetterEntity $patientLetter)
    {
        $this->patientLetters->removeElement($patientLetter);
    }

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

    /**
     * Add patientChart
     *
     * @param \RxConnexionBundle\Entity\PatientChartEntity $patientChart
     *
     * @return AccountUserEntity
     */
    public function addPatientChart(\RxConnexionBundle\Entity\PatientChartEntity $patientChart)
    {
        $this->patientCharts[] = $patientChart;

        return $this;
    }

    /**
     * Remove patientChart
     *
     * @param \RxConnexionBundle\Entity\PatientChartEntity $patientChart
     */
    public function removePatientChart(\RxConnexionBundle\Entity\PatientChartEntity $patientChart)
    {
        $this->patientCharts->removeElement($patientChart);
    }


    /**
     * Set accountUserBilling
     *
     * @param \RxConnexionBundle\Entity\AccountUserBillingEntity $accountUserBilling
     *
     * @return AccountUserEntity
     */
    public function setAccountUserBilling(\RxConnexionBundle\Entity\AccountUserBillingEntity $accountUserBilling = null)
    {
        $this->accountUserBilling = $accountUserBilling;

        return $this;
    }

    /**
     * Get accountUserBilling
     *
     * @return \RxConnexionBundle\Entity\AccountUserBillingEntity
     */
    public function getAccountUserBilling()
    {
        return $this->accountUserBilling;
    }

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

    /**
     * Add accountUserReminder
     *
     * @param \RxConnexionBundle\Entity\AccountUserReminderEntity $accountUserReminder
     *
     * @return AccountUserEntity
     */
    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 assignedToAccountUserReminder
     *
     * @param \RxConnexionBundle\Entity\AccountUserReminderEntity $assignedToAccountUserReminder
     *
     * @return AccountUserEntity
     */
    public function addAssignedToAccountUserReminder(\RxConnexionBundle\Entity\AccountUserReminderEntity $assignedToAccountUserReminder)
    {
        $this->assignedToAccountUserReminders[] = $assignedToAccountUserReminder;

        return $this;
    }

    /**
     * Remove assignedToAccountUserReminder
     *
     * @param \RxConnexionBundle\Entity\AccountUserReminderEntity $assignedToAccountUserReminder
     */
    public function removeAssignedToAccountUserReminder(\RxConnexionBundle\Entity\AccountUserReminderEntity $assignedToAccountUserReminder)
    {
        $this->assignedToAccountUserReminders->removeElement($assignedToAccountUserReminder);
    }

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

    /**
     * Add userGroupAccountUser
     *
     * @param \RxConnexionBundle\Entity\UserGroupAccountUserEntity $userGroupAccountUser
     *
     * @return AccountUserEntity
     */
    public function addUserGroupAccountUser(\RxConnexionBundle\Entity\UserGroupAccountUserEntity $userGroupAccountUser)
    {
        $this->userGroupAccountUsers[] = $userGroupAccountUser;

        return $this;
    }

    /**
     * Remove userGroupAccountUser
     *
     * @param \RxConnexionBundle\Entity\UserGroupAccountUserEntity $userGroupAccountUser
     */
    public function removeUserGroupAccountUser(\RxConnexionBundle\Entity\UserGroupAccountUserEntity $userGroupAccountUser)
    {
        $this->userGroupAccountUsers->removeElement($userGroupAccountUser);
    }

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

    /**
     * Add accountUserCc
     *
     * @param \RxConnexionBundle\Entity\UserGroupAccountUserEntity $accountUserCc
     *
     * @return AccountUserEntity
     */
    public function addAccountUserCc(\RxConnexionBundle\Entity\UserGroupAccountUserEntity $accountUserCc)
    {
        $this->accountUserCcs[] = $accountUserCc;

        return $this;
    }

    /**
     * Remove accountUserCc
     *
     * @param \RxConnexionBundle\Entity\UserGroupAccountUserEntity $accountUserCc
     */
    public function removeAccountUserCc(\RxConnexionBundle\Entity\UserGroupAccountUserEntity $accountUserCc)
    {
        $this->accountUserCcs->removeElement($accountUserCc);
    }

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

    /**
     * Add ticketCc
     *
     * @param \RxConnexionBundle\Entity\TicketCcEntity $ticketCc
     *
     * @return AccountUserEntity
     */
    public function addTicketCc(\RxConnexionBundle\Entity\TicketCcEntity $ticketCc)
    {
        $this->ticketCcs[] = $ticketCc;

        return $this;
    }

    /**
     * Remove ticketCc
     *
     * @param \RxConnexionBundle\Entity\TicketCcEntity $ticketCc
     */
    public function removeTicketCc(\RxConnexionBundle\Entity\TicketCcEntity $ticketCc)
    {
        $this->ticketCcs->removeElement($ticketCc);
    }

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

    /**
     * Add rxApiSession
     *
     * @param \RxConnexionBundle\Entity\RxApiSessionEntity $rxApiSession
     *
     * @return AccountUserEntity
     */
    public function addRxApiSession(\RxConnexionBundle\Entity\RxApiSessionEntity $rxApiSession)
    {
        $this->rxApiSessions[] = $rxApiSession;

        return $this;
    }

    /**
     * Remove rxApiSession
     *
     * @param \RxConnexionBundle\Entity\RxApiSessionEntity $rxApiSession
     */
    public function removeRxApiSession(\RxConnexionBundle\Entity\RxApiSessionEntity $rxApiSession)
    {
        $this->rxApiSessions->removeElement($rxApiSession);
    }

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

    /**
     * Add loginTracker
     *
     * @param \RxConnexionBundle\Entity\LoginTrackerEntity $loginTracker
     *
     * @return AccountUserEntity
     */
    public function addLoginTracker(\RxConnexionBundle\Entity\LoginTrackerEntity $loginTracker)
    {
        $this->loginTrackers[] = $loginTracker;

        return $this;
    }

    /**
     * Remove loginTracker
     *
     * @param \RxConnexionBundle\Entity\LoginTrackerEntity $loginTracker
     */
    public function removeLoginTracker(\RxConnexionBundle\Entity\LoginTrackerEntity $loginTracker)
    {
        $this->loginTrackers->removeElement($loginTracker);
    }

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

    /**
     * Add transferInventory
     *
     * @param \RxConnexionBundle\Entity\TransferInventoryEntity $transferInventory
     *
     * @return AccountUserEntity
     */
    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;
    }

    /**
     * Add patientChartCc
     *
     * @param \RxConnexionBundle\Entity\PatientChartCcEntity $patientChartCc
     *
     * @return AccountUserEntity
     */
    public function addPatientChartCc(\RxConnexionBundle\Entity\PatientChartCcEntity $patientChartCc)
    {
        $this->patientChartCcs[] = $patientChartCc;

        return $this;
    }

    /**
     * Remove patientChartCc
     *
     * @param \RxConnexionBundle\Entity\PatientChartCcEntity $patientChartCc
     */
    public function removePatientChartCc(\RxConnexionBundle\Entity\PatientChartCcEntity $patientChartCc)
    {
        $this->patientChartCcs->removeElement($patientChartCc);
    }

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