<?php
declare(strict_types=1);

namespace App\Entity\Person;

use ApiPlatform\Core\Annotation\ApiResource;
use App\Entity\Access\Access;
use DH\Auditor\Provider\Doctrine\Auditing\Annotation\Auditable;
use Doctrine\ORM\Mapping as ORM;

/**
 * Classe ... qui ...
 */
#[Auditable]
#[ORM\Entity]
#[ApiResource(
    collectionOperations:[],
    itemOperations: [
        "get" => ["security" => "is_granted('ROLE_ADMIN')"]
    ]
)]
class CommissionMember
{
    #[ORM\Id]
    #[ORM\Column]
    #[ORM\GeneratedValue]
    private ?int $id = null;

    #[ORM\ManyToOne(inversedBy: 'commissionMembers')]
    #[ORM\JoinColumn(nullable: false)]
    private Commission $commission;

    #[ORM\ManyToOne(inversedBy: 'commissionMembers')]
    #[ORM\JoinColumn(nullable: false)]
    private Access $member;

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

    public function getCommission(): ?Commission
    {
        return $this->commission;
    }

    public function setCommission(?Commission $commission): self
    {
        $this->commission = $commission;

        return $this;
    }

    public function getMember(): ?Access
    {
        return $this->member;
    }

    public function setMember(?Access $member): self
    {
        $this->member = $member;

        return $this;
    }
}
