<?php

/*
 * @codingStandardsIgnoreFile
 *
 * Auto generated file ignore for Code Sniffer
 */

namespace App\Entity;

use Carbon\Carbon;
use DateTime;
use Doctrine\ORM\Mapping as ORM;
use Right;

/**
 * Rightsvolunteers.
 *
 * @SuppressWarnings("PHPMD")
 * Auto generated class do not check mess
 */
#[ORM\Table(name: 'rightsvolunteers')]
#[ORM\UniqueConstraint(name: 'rightsvolunteers_members', columns: ['IdMember', 'IdRight'])]
#[ORM\Entity]
#[ORM\HasLifecycleCallbacks]
class RightVolunteer
{
    /**
     * @var int
     */
    #[ORM\Id]
    #[ORM\GeneratedValue(strategy: 'IDENTITY')]
    #[ORM\Column(type: 'integer')]
    private $id;

    #[ORM\JoinColumn(name: 'IdMember', referencedColumnName: 'id')]
    #[ORM\ManyToOne(targetEntity: \Member::class, inversedBy: 'volunteerRights')]
    private $member;

    #[ORM\JoinColumn(name: 'IdRight', referencedColumnName: 'id')]
    #[ORM\ManyToOne(targetEntity: Right::class, inversedBy: 'rightVolunteers')]
    private $right;

    /**
     * @var int
     */
    #[ORM\Column(name: 'Level', type: 'integer', nullable: false)]
    private $level = '0';

    /**
     * @var string
     */
    #[ORM\Column(name: 'Scope', type: 'text', length: 255, nullable: false)]
    private $scope;

    /**
     * @var string
     */
    #[ORM\Column(name: 'Comment', type: 'text', length: 65535, nullable: false)]
    private $comment;

    /**
     * @var DateTime
     */
    #[ORM\Column(name: 'updated', type: 'datetime', nullable: false)]
    private $updated;

    /**
     * @var DateTime
     */
    #[ORM\Column(name: 'created', type: 'datetime', nullable: false)]
    private $created;

    /**
     * @return Member
     */
    public function getMember()
    {
        return $this->member;
    }

    /**
     * @param Member $member
     */
    public function setMember($member)
    {
        $this->member = $member;
    }

    public function getRight()
    {
        return $this->right;
    }

    public function setRight($right)
    {
        $this->right = $right;
    }

    /**
     * Set level.
     *
     * @param int $level
     *
     * @return RightVolunteer
     */
    public function setLevel($level)
    {
        $this->level = $level;

        return $this;
    }

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

    /**
     * Set scope.
     *
     * @param string $scope
     *
     * @return RightVolunteer
     */
    public function setScope($scope)
    {
        $this->scope = $scope;

        return $this;
    }

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

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

        return $this;
    }

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

    /**
     * Set updated.
     *
     * @param DateTime $updated
     *
     * @return RightVolunteer
     */
    public function setUpdated($updated)
    {
        $this->updated = $updated;

        return $this;
    }

    /**
     * Get updated.
     *
     * @return DateTime
     */
    public function getUpdated()
    {
        return $this->updated;
    }

    /**
     * Set created.
     *
     * @param DateTime $created
     *
     * @return RightVolunteer
     */
    public function setCreated($created)
    {
        $this->created = $created;

        return $this;
    }

    /**
     * Get created.
     *
     * @return Carbon
     */
    public function getCreated()
    {
        return Carbon::instance($this->created);
    }

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

    /**
     * Triggered on insert.
     */
    #[ORM\PrePersist]
    public function onPrePersist()
    {
        $this->created = new DateTime('now');
    }

    /**
     * Triggered on update.
     */
    #[ORM\PreUpdate]
    public function onPreUpdate()
    {
        $this->updated = new DateTime('now');
    }
}
