<?php
declare (strict_types=1);

namespace App\Entity\Billing;

use ApiPlatform\Metadata\Get;
use ApiPlatform\Metadata\ApiResource;
use App\Entity\Access\Access;
use App\Entity\Booking\EducationalProject;
use App\Entity\Product\EquipmentLoan;
//use DH\Auditor\Provider\Doctrine\Auditing\Annotation\Auditable;
use Doctrine\ORM\Mapping as ORM;

/**
 * Classe ... qui ...
 */
#[ApiResource(
    operations: [
        new Get(
            security: 'is_granted(\'ROLE_ADMIN\') and object.getAccess().getOrganization().getId() == user.getOrganization().getId()'
        )
    ]
)]
//#[Auditable]
#[ORM\Entity]
class BillLine
{
    #[ORM\Id]
    #[ORM\Column]
    #[ORM\GeneratedValue]
    private ?int $id = null;

    #[ORM\ManyToOne(inversedBy: 'billLines')]
    #[ORM\JoinColumn(nullable: false)]
    private BillAccounting $bill;

    #[ORM\ManyToOne(inversedBy: 'billLines')]
    private Access $access;

    #[ORM\ManyToOne(inversedBy: 'billLines')]
    private EducationalProject $educationalProject;

    #[ORM\ManyToOne(inversedBy: 'billLines')]
    private EquipmentLoan $equipmentLoan;

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

    public function getBill(): ?BillAccounting
    {
        return $this->bill;
    }

    public function setBill(?BillAccounting $bill): self
    {
        $this->bill = $bill;
        return $this;
    }

    public function getAccess(): ?Access
    {
        return $this->access;
    }

    public function setAccess(?Access $access): self
    {
        $this->access = $access;
        return $this;
    }

    public function getEducationalProject(): ?EducationalProject
    {
        return $this->educationalProject;
    }

    public function setEducationalProject(?EducationalProject $educationalProject): self
    {
        $this->educationalProject = $educationalProject;
        return $this;
    }

    public function getEquipmentLoan(): ?EquipmentLoan
    {
        return $this->equipmentLoan;
    }

    public function setEquipmentLoan(?EquipmentLoan $equipmentLoan): self
    {
        $this->equipmentLoan = $equipmentLoan;
        return $this;
    }
}