<?php

namespace App\Entity;

use App\Repository\AssetnameRepository;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;

/**
 * @ORM\Entity(repositoryClass=AssetnameRepository::class)
 */
class Assetname
{
    public const NUM_ITEMS = 10;
    /**
     * @ORM\Id
     * @ORM\GeneratedValue
     * @ORM\Column(type="integer")
     */
    private $id;

    /**
     * @ORM\ManyToOne(targetEntity=Group::class, inversedBy="assetnames")
     * @ORM\JoinColumn(nullable=false)
     */
    private $groups;

    /**
     * @ORM\ManyToOne(targetEntity=Subgroup::class, inversedBy="assetnames")
     * @ORM\JoinColumn(nullable=false)
     */
    private $subgroup;

    /**
     * @ORM\Column(type="string", length=255)
     */
    private $name;

    /**
     * @ORM\ManyToOne(targetEntity=Unit::class, inversedBy="assetnames")
     * @ORM\JoinColumn(nullable=false)
     */
    private $unit;

    /**
     * @ORM\Column(type="string", length=255, nullable=true)
     */
    private $remarks;

    /**
     * @ORM\Column(type="string", length=255, nullable=true)
     */
    private $note;

    /**
     * @ORM\Column(type="integer", nullable=true)
     */
    private $status;

    /**
     * @ORM\Column(type="integer", nullable=true)
     */
    private $type;

    /**
     * @ORM\Column(type="datetime", nullable=true)
     */
    private $entrydate;

    /**
     * @ORM\Column(type="integer", nullable=true)
     */
    private $entryby;

    /**
     * @ORM\Column(type="datetime", nullable=true)
     */
    private $editdate;

    /**
     * @ORM\Column(type="datetime", nullable=true)
     */
    private $editby;

    /**
     * @ORM\OneToMany(targetEntity=Assetregister::class, mappedBy="assetname")
     */
    private $assetregisters;

    public function __construct()
    {
        $this->assetregisters = new ArrayCollection();
    }

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

    public function getGroups(): ?Group
    {
        return $this->groups;
    }

    public function setGroups(?Group $groups): self
    {
        $this->groups = $groups;

        return $this;
    }

    public function getSubgroup(): ?Subgroup
    {
        return $this->subgroup;
    }

    public function setSubgroup(?Subgroup $subgroup): self
    {
        $this->subgroup = $subgroup;

        return $this;
    }

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

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

        return $this;
    }

    public function getUnit(): ?Unit
    {
        return $this->unit;
    }

    public function setUnit(?Unit $unit): self
    {
        $this->unit = $unit;

        return $this;
    }

    public function getRemarks(): ?string
    {
        return $this->remarks;
    }

    public function setRemarks(?string $remarks): self
    {
        $this->remarks = $remarks;

        return $this;
    }

    public function getNote(): ?string
    {
        return $this->note;
    }

    public function setNote(?string $note): self
    {
        $this->note = $note;

        return $this;
    }

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

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

        return $this;
    }

    public function getType(): ?int
    {
        return $this->type;
    }

    public function setType(?int $type): self
    {
        $this->type = $type;

        return $this;
    }

    public function getEntrydate(): ?\DateTimeInterface
    {
        return $this->entrydate;
    }

    public function setEntrydate(?\DateTimeInterface $entrydate): self
    {
        $this->entrydate = $entrydate;

        return $this;
    }

    public function getEntryby(): ?int
    {
        return $this->entryby;
    }

    public function setEntryby(?int $entryby): self
    {
        $this->entryby = $entryby;

        return $this;
    }

    public function getEditdate(): ?\DateTimeInterface
    {
        return $this->editdate;
    }

    public function setEditdate(?\DateTimeInterface $editdate): self
    {
        $this->editdate = $editdate;

        return $this;
    }

    public function getEditby(): ?\DateTimeInterface
    {
        return $this->editby;
    }

    public function setEditby(?\DateTimeInterface $editby): self
    {
        $this->editby = $editby;

        return $this;
    }

    /**
     * @return Collection|Assetregister[]
     */
    public function getAssetregisters(): Collection
    {
        return $this->assetregisters;
    }

    public function addAssetregister(Assetregister $assetregister): self
    {
        if (!$this->assetregisters->contains($assetregister)) {
            $this->assetregisters[] = $assetregister;
            $assetregister->setAssetname($this);
        }

        return $this;
    }

    public function removeAssetregister(Assetregister $assetregister): self
    {
        if ($this->assetregisters->removeElement($assetregister)) {
            // set the owning side to null (unless already changed)
            if ($assetregister->getAssetname() === $this) {
                $assetregister->setAssetname(null);
            }
        }

        return $this;
    }

}
