<?php

namespace App\Entity;

use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
use Symfony\Component\Validator\Constraints as Assert;

/**
 * @ORM\Entity()
 */
class NegotiationStatus implements BroadcastableInterface
{
    /**
     * @ORM\Id()
     * @ORM\GeneratedValue()
     * @ORM\Column(type="integer")
     */
    private $id;

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

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

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

    /**
     * @ORM\OneToMany(targetEntity="App\Entity\Negotiation", mappedBy="status")
     */
    private $negotiations;

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

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

    public function getTitle(): ?string
    {
        return $this->title;
    }

    public function setTitle(string $title): self
    {
        $this->title = $title;

        return $this;
    }

    public function getOrderLvl(): ?int
    {
        return $this->orderLvl;
    }

    public function setOrderLvl(?int $orderLvl): self
    {
        $this->orderLvl = $orderLvl;

        return $this;
    }

    public function getOptions()
    {
        return json_decode($this->options, true);
    }

    public function setOptions($options): self
    {
        $this->options = $options;

        return $this;
    }

//    /**
//     * @return Collection|Negotiation[]
//     */
//    public function getNegotiations(): Collection
//    {
//        return $this->negotiations;
//    }
//
//    public function addNegotiation(Negotiation $negotiation): self
//    {
//        if (!$this->negotiations->contains($negotiation)) {
//            $this->negotiations[] = $negotiation;
//            $negotiation->setUser($this);
//        }
//
//        return $this;
//    }
//
//    public function removeNegotiation(Negotiation $negotiation): self
//    {
//        if ($this->negotiations->contains($negotiation)) {
//            $this->negotiations->removeElement($negotiation);
//            // set the owning side to null (unless already changed)
//            if ($negotiation->getUser() === $this) {
//                $negotiation->setUser(null);
//            }
//        }
//
//        return $this;
//    }
    public function getDataType(): string
    {
        return 'negotiationstatus';
    }
}
