<?php

namespace AppBundle\Entity;

use AppBundle\Utils\Traits\TimestampableTrait;
use Doctrine\ORM\Mapping as ORM;

/**
 * BookmarkSearch
 *
 * @ORM\Table(name="bookmark_search")
 * @ORM\Entity(repositoryClass="AppBundle\Repository\BookmarkSearchRepository")
 * @ORM\HasLifecycleCallbacks()
 */
class BookmarkSearch
{

    use TimestampableTrait;

    /**
     * @var int
     *
     * @ORM\Column(name="id", type="integer")
     * @ORM\Id
     * @ORM\GeneratedValue(strategy="AUTO")
     */
    private $id;

    /**
     * @var array
     *
     * @ORM\Column(name="criteria", type="json_document", options={"jsonb": true})
     */
    private $criteria;

    /**
     * @ORM\oneToOne(targetEntity="AppBundle\Entity\Bookmark", cascade={"persist", "remove"})
     */
    private $bookmark;

    /**
     * @var bool
     *
     * @ORM\Column(name="is_active", type="boolean", nullable=true)
     */
    private $isActive;

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

    /***********************
     * Constructor
     ***********************/
    public function __construct($criteria = null, Bookmark $bm = null)
    {
        $this->criteria = $criteria;
        $this->bookmark = $bm;
        $this->label = 'default_label';
        $this->isActive = true;
    }

    /***********************
     * Getters & Setters
     ***********************/

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

    /**
     * Set criteria.
     *
     * @param array $criteria
     *
     * @return BookmarkSearch
     */
    public function setCriteria($criteria)
    {
        $this->criteria = $criteria;

        return $this;
    }

    /**
     * Get criteria.
     *
     * @return array
     */
    public function getCriteria()
    {
        return $this->criteria;
    }

    /**
     * Set isActive.
     *
     * @param bool|null $isActive
     *
     * @return BookmarkSearch
     */
    public function setIsActive($isActive = null)
    {
        $this->isActive = $isActive;

        return $this;
    }

    /**
     * Get isActive.
     *
     * @return bool|null
     */
    public function getIsActive()
    {
        return $this->isActive;
    }

    /**
     * Set label.
     *
     * @param string $label
     *
     * @return BookmarkSearch
     */
    public function setLabel($label)
    {
        $this->label = $label;

        return $this;
    }

    /**
     * Get label.
     *
     * @return string
     */
    public function getLabel()
    {
        return $this->label;
    }

    /**
     * Set bookmark.
     *
     * @param \AppBundle\Entity\Bookmark|null $bookmark
     *
     * @return BookmarkSearch
     */
    public function setBookmark(\AppBundle\Entity\Bookmark $bookmark = null)
    {
        $this->bookmark = $bookmark;

        return $this;
    }

    /**
     * Get bookmark.
     *
     * @return \AppBundle\Entity\Bookmark|null
     */
    public function getBookmark()
    {
        return $this->bookmark;
    }
}
