<?php

namespace App\Entity;

use ApiPlatform\Core\Annotation\ApiResource;
use App\Repository\TStaffMembersRepository;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;

use ApiPlatform\Core\Annotation\ApiFilter;
use ApiPlatform\Core\Bridge\Doctrine\Orm\Filter\SearchFilter;
use ApiPlatform\Core\Bridge\Doctrine\Orm\Filter\RangeFilter;

use ApiPlatform\Core\Serializer\Filter\PropertyFilter;
use Symfony\Component\Serializer\Annotation\Groups;

/**
 * @ApiResource(
 *     normalizationContext={"groups"={"t_staff_members:read"}, "enable_max_depth"="true", "swagger_definition_name"="Read"},
 *     denormalizationContext={"groups"={"t_staff_members:write"}, "swagger_definition_name"="Write"}
 * )
 * @ApiFilter(PropertyFilter::class)
 * @ApiFilter(SearchFilter::class, properties={ "id": "exact", "status": "exact" })
 * @ORM\Entity(repositoryClass=TStaffMembersRepository::class)
 */

class TStaffMembers
{
    /**
     * @ORM\Id
     * @ORM\GeneratedValue
     * @ORM\Column(type="integer")
     * @Groups({"User:read"})
     */
    private $id;

    /**
     * @ORM\Column(type="string", length=255, nullable=true)
     * @Groups({ "t_staff_members:read", "t_staff_members:write", "User:read"})
     */
    private $name;

    /**
     * @ORM\Column(type="string", length=60, nullable=true)
     * @Groups({ "t_staff_members:read", "t_staff_members:write", "User:read" })
     */
    private $phoneNo1;

    /**
     * @ORM\Column(type="string", length=60, nullable=true)
     * @Groups({ "t_staff_members:read", "t_staff_members:write", "User:read" })
     */
    private $phoneNo2;

    /**
     * @ORM\Column(type="string", length=60, nullable=true)
     * @Groups({ "t_staff_members:read", "t_staff_members:write", "User:read" })
     */
    private $emailAdd;

    /**
     * @ORM\Column(type="string", length=60, nullable=true)
     * @Groups({ "t_staff_members:read", "t_staff_members:write", "User:read" })
     */
    private $phyAdd;

    /**
     * @ORM\Column(type="string", length=255, nullable=true)
     * @Groups({ "t_staff_members:read", "t_staff_members:write", "User:read" })
     */
    private $nextOfKinName;

    /**
     * @ORM\Column(type="string", length=60, nullable=true)
     * @Groups({ "t_staff_members:read", "t_staff_members:write", "User:read" })
     */
    private $nextOfKinContact;

    /**
     * @ORM\Column(type="string", length=60, nullable=true)
     * @Groups({ "t_staff_members:read", "t_staff_members:write", "User:read" })
     */
    private $status;

    /**
     * @ORM\OneToMany(targetEntity=TTransactionsTempsMains::class, mappedBy="staffMember")
     * @Groups({ "t_staff_members:read", "t_staff_members:write", "User:read" })
     */
    private $tTransactionsTempsMains;

    /**
     * @ORM\OneToMany(targetEntity=TTransactionsAccounts::class, mappedBy="staffMember")
     * @Groups({ "t_staff_members:read", "t_staff_members:write", "User:read" })
     */
    private $tTransactionsAccounts;

    /**
     * @ORM\OneToMany(targetEntity=TTransactionsDetails::class, mappedBy="staffMember")
     * @Groups({ "t_staff_members:read", "t_staff_members:write", "User:read" })
     */
    private $tTransactionsDetails;

    /**
     * @ORM\OneToMany(targetEntity=TTransactionsTempsCashier::class, mappedBy="staffMember")
     */
    private $tTransactionsTempsCashiers;

    /**
     * @ORM\OneToMany(targetEntity=TTransactionsCashier::class, mappedBy="staffMember")
     * @Groups({ "t_staff_members:read", "t_staff_members:write", "User:read" })
     */
    private $tTransactionsCashiers;

    /**
     * @ORM\Column(type="string", length=60, nullable=true)
     * @Groups({ "t_staff_members:read", "t_staff_members:write", "User:read", "t_transactions_cashiers:read", "t_transactions_temps_mains:read","t_transactions_temps_details:read", "t_transactions_temps_cashiers:read", "t_transactions_accounts:read", "t_transactions_details:read" })
     */
    private $firstName;

    /**
     * @ORM\Column(type="string", length=60, nullable=true)
     * @Groups({ "t_staff_members:read", "t_staff_members:write", "User:read" })
     */
    private $middleName;

    /**
     * @ORM\Column(type="string", length=60, nullable=true)
     * @Groups({ "t_staff_members:read", "t_staff_members:write", "User:read" })
     */
    private $lastName;

    public function __construct()
    {
        $this->users = new ArrayCollection();
        $this->tTransactionsTempsMains = new ArrayCollection();
        $this->tTransactionsAccounts = new ArrayCollection();
        $this->tTransactionsDetails = new ArrayCollection();
        $this->tTransactionsTempsCashiers = new ArrayCollection();
        $this->tTransactionsCashiers = new ArrayCollection();
    }

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

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

    public function setName(?string $name): self
    {
        $this->name = $name;

        return $this;
    }

    public function getPhoneNo1(): ?string
    {
        return $this->phoneNo1;
    }

    public function setPhoneNo1(?string $phoneNo1): self
    {
        $this->phoneNo1 = $phoneNo1;

        return $this;
    }

    public function getPhoneNo2(): ?string
    {
        return $this->phoneNo2;
    }

    public function setPhoneNo2(string $phoneNo2): self
    {
        $this->phoneNo2 = $phoneNo2;

        return $this;
    }

    public function getEmailAdd(): ?string
    {
        return $this->emailAdd;
    }

    public function setEmailAdd(?string $emailAdd): self
    {
        $this->emailAdd = $emailAdd;

        return $this;
    }

    public function getPhyAdd(): ?string
    {
        return $this->phyAdd;
    }

    public function setPhyAdd(?string $phyAdd): self
    {
        $this->phyAdd = $phyAdd;

        return $this;
    }

    public function getNextOfKinName(): ?string
    {
        return $this->nextOfKinName;
    }

    public function setNextOfKinName(?string $nextOfKinName): self
    {
        $this->nextOfKinName = $nextOfKinName;

        return $this;
    }

    public function getNextOfKinContact(): ?string
    {
        return $this->nextOfKinContact;
    }

    public function setNextOfKinContact(?string $nextOfKinContact): self
    {
        $this->nextOfKinContact = $nextOfKinContact;

        return $this;
    }

    public function getStatus(): ?string
    {
        return $this->status;
    }

    public function setStatus(?string $status): self
    {
        $this->status = $status;

        return $this;
    }

    /**
     * @return Collection|TTransactionsTempsMains[]
     */
    public function getTTransactionsTempsMains(): Collection
    {
        return $this->tTransactionsTempsMains;
    }

    public function addTTransactionsTempsMain(TTransactionsTempsMains $tTransactionsTempsMain): self
    {
        if (!$this->tTransactionsTempsMains->contains($tTransactionsTempsMain)) {
            $this->tTransactionsTempsMains[] = $tTransactionsTempsMain;
            $tTransactionsTempsMain->setStaffMember($this);
        }

        return $this;
    }

    public function removeTTransactionsTempsMain(TTransactionsTempsMains $tTransactionsTempsMain): self
    {
        if ($this->tTransactionsTempsMains->removeElement($tTransactionsTempsMain)) {
            // set the owning side to null (unless already changed)
            if ($tTransactionsTempsMain->getStaffMember() === $this) {
                $tTransactionsTempsMain->setStaffMember(null);
            }
        }

        return $this;
    }

    /**
     * @return Collection|TTransactionsAccounts[]
     */
    public function getTTransactionsAccounts(): Collection
    {
        return $this->tTransactionsAccounts;
    }

    public function addTTransactionsAccount(TTransactionsAccounts $tTransactionsAccount): self
    {
        if (!$this->tTransactionsAccounts->contains($tTransactionsAccount)) {
            $this->tTransactionsAccounts[] = $tTransactionsAccount;
            $tTransactionsAccount->setStaffMember($this);
        }

        return $this;
    }

    public function removeTTransactionsAccount(TTransactionsAccounts $tTransactionsAccount): self
    {
        if ($this->tTransactionsAccounts->removeElement($tTransactionsAccount)) {
            // set the owning side to null (unless already changed)
            if ($tTransactionsAccount->getStaffMember() === $this) {
                $tTransactionsAccount->setStaffMember(null);
            }
        }

        return $this;
    }

    /**
     * @return Collection|TTransactionsDetails[]
     */
    public function getTTransactionsDetails(): Collection
    {
        return $this->tTransactionsDetails;
    }

    public function addTTransactionsDetail(TTransactionsDetails $tTransactionsDetail): self
    {
        if (!$this->tTransactionsDetails->contains($tTransactionsDetail)) {
            $this->tTransactionsDetails[] = $tTransactionsDetail;
            $tTransactionsDetail->setStaffMember($this);
        }

        return $this;
    }

    public function removeTTransactionsDetail(TTransactionsDetails $tTransactionsDetail): self
    {
        if ($this->tTransactionsDetails->removeElement($tTransactionsDetail)) {
            // set the owning side to null (unless already changed)
            if ($tTransactionsDetail->getStaffMember() === $this) {
                $tTransactionsDetail->setStaffMember(null);
            }
        }

        return $this;
    }

    /**
     * @return Collection|TTransactionsTempsCashier[]
     */
    public function getTTransactionsTempsCashiers(): Collection
    {
        return $this->tTransactionsTempsCashiers;
    }

    public function addTTransactionsTempsCashier(TTransactionsTempsCashier $tTransactionsTempsCashier): self
    {
        if (!$this->tTransactionsTempsCashiers->contains($tTransactionsTempsCashier)) {
            $this->tTransactionsTempsCashiers[] = $tTransactionsTempsCashier;
            $tTransactionsTempsCashier->setStaffMember($this);
        }

        return $this;
    }

    public function removeTTransactionsTempsCashier(TTransactionsTempsCashier $tTransactionsTempsCashier): self
    {
        if ($this->tTransactionsTempsCashiers->removeElement($tTransactionsTempsCashier)) {
            // set the owning side to null (unless already changed)
            if ($tTransactionsTempsCashier->getStaffMember() === $this) {
                $tTransactionsTempsCashier->setStaffMember(null);
            }
        }

        return $this;
    }

    /**
     * @return Collection|TTransactionsCashier[]
     */
    public function getTTransactionsCashiers(): Collection
    {
        return $this->tTransactionsCashiers;
    }

    public function addTTransactionsCashier(TTransactionsCashier $tTransactionsCashier): self
    {
        if (!$this->tTransactionsCashiers->contains($tTransactionsCashier)) {
            $this->tTransactionsCashiers[] = $tTransactionsCashier;
            $tTransactionsCashier->setStaffMember($this);
        }

        return $this;
    }

    public function removeTTransactionsCashier(TTransactionsCashier $tTransactionsCashier): self
    {
        if ($this->tTransactionsCashiers->removeElement($tTransactionsCashier)) {
            // set the owning side to null (unless already changed)
            if ($tTransactionsCashier->getStaffMember() === $this) {
                $tTransactionsCashier->setStaffMember(null);
            }
        }

        return $this;
    }

    public function getFirstName(): ?string
    {
        return $this->firstName;
    }

    public function setFirstName(?string $firstName): self
    {
        $this->firstName = $firstName;

        return $this;
    }

    public function getMiddleName(): ?string
    {
        return $this->middleName;
    }

    public function setMiddleName(?string $middleName): self
    {
        $this->middleName = $middleName;

        return $this;
    }

    public function getLastName(): ?string
    {
        return $this->lastName;
    }

    public function setLastName(?string $lastName): self
    {
        $this->lastName = $lastName;

        return $this;
    }

}
