<?php

namespace AppBundle\Entity;

use Gedmo\Mapping\Annotation as Gedmo;
use Doctrine\ORM\Mapping as ORM;
use Symfony\Component\Validator\Constraints as Assert;

/**
 * ChangeRequest
 *
 * @ORM\Table(name="change_request")
 * @ORM\Entity(repositoryClass="AppBundle\Repository\ChangeRequestRepository")
 */
class ChangeRequest
{
    /**
     * @var int
     *
     * @ORM\Column(name="id", type="integer")
     * @ORM\Id
     * @ORM\GeneratedValue(strategy="AUTO")
     */
    private $id;

    /**
     * @var string
     *
     * @ORM\Column(name="fieldName", type="string", length=255, nullable=true)
     * @Assert\Length(max=255)
     */
    private $fieldName;

    /**
     * @var string
     *
     * @ORM\Column(name="comment", type="text", nullable=true)
     */
    private $comment;

    /**
     * @var string
     *
     * @ORM\Column(type="string", length=512, nullable=true)
     */
    private $curatorRemarks;

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

    /**
     * @var Adventure
     *
     * @ORM\ManyToOne(targetEntity="Adventure", inversedBy="changeRequests")
     */
    private $adventure;

    /**
     * @var string
     *
     * @Gedmo\Blameable(on="create")
     * @ORM\Column(type="string", nullable=true)
     */
    private $createdBy;

    /**
     * @var string
     *
     * @ORM\Column(type="string", nullable=true)
     * @Gedmo\Blameable(on="change", field={"title"})
     */
    private $updatedBy;

    /**
     * @var \DateTime
     *
     * @Gedmo\Timestampable(on="create")
     * @ORM\Column(type="datetime")
     */
    private $createdAt;

    /**
     * @var \DateTime
     *
     * @Gedmo\Timestampable(on="update")
     * @ORM\Column(type="datetime")
     */
    private $updatedAt;

    public function __construct()
    {
        $this->resolved = false;
    }

    public function __toString(): string
    {
        return '#'.$this->id;
    }

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

    /**
     * Set fieldName
     *
     * @param string $fieldName
     *
     * @return ChangeRequest
     */
    public function setFieldName($fieldName)
    {
        $this->fieldName = $fieldName;

        return $this;
    }

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

    /**
     * Set comment
     *
     * @param string $comment
     *
     * @return ChangeRequest
     */
    public function setComment($comment)
    {
        $this->comment = $comment;

        return $this;
    }

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

    /**
     * @return string
     */
    public function getCuratorRemarks()
    {
        return $this->curatorRemarks;
    }

    /**
     * @param string $curatorRemarks
     *
     * @return ChangeRequest
     */
    public function setCuratorRemarks($curatorRemarks)
    {
        $this->curatorRemarks = $curatorRemarks;

        return $this;
    }

    public function isResolved(): bool
    {
        return $this->resolved;
    }

    /**
     * @param bool $resolved
     *
     * @return ChangeRequest
     */
    public function setResolved($resolved = true)
    {
        $this->resolved = $resolved;

        return $this;
    }

    /**
     * @return Adventure
     */
    public function getAdventure()
    {
        return $this->adventure;
    }

    /**
     * @return ChangeRequest
     */
    public function setAdventure(Adventure $adventure)
    {
        $this->adventure = $adventure;

        return $this;
    }

    /**
     * @return string
     */
    public function getCreatedBy()
    {
        return $this->createdBy;
    }

    /**
     * @return string
     */
    public function getUpdatedBy()
    {
        return $this->updatedBy;
    }

    /**
     * @return \DateTime
     */
    public function getCreatedAt()
    {
        return $this->createdAt;
    }

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