<?php

declare(strict_types=1);

namespace App\Entity\Product;

use ApiPlatform\Metadata\ApiResource;
use App\Entity\Access\Access;
use App\Entity\Core\AbstractRepair;
// use DH\Auditor\Provider\Doctrine\Auditing\Annotation\Auditable;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\ORM\Mapping as ORM;

/**
 * @todo : A la suite de la migration, il faut supprimer le nom de la table pour avoir une table EquipmentRepair, et supprimer l'attribut discr.
 * @todo : migration table tag_repair
 *
 * Réparation effectuée sur un Equipment
 */
// #[Auditable]
#[ApiResource(operations: [])]
#[ORM\Entity]
class EquipmentRepair extends AbstractRepair
{
    #[ORM\ManyToOne(inversedBy: 'equipmentRepairProviders')]
    #[ORM\JoinColumn(referencedColumnName: 'id', nullable: true, onDelete: 'SET NULL')]
    protected ?Access $provider = null;

    #[ORM\ManyToOne(inversedBy: 'equipmentRepair')]
    protected ?Equipment $equipment = null;

    public function __construct()
    {
        $this->tags = new ArrayCollection();
    }

    public function getProvider(): ?Access
    {
        return $this->provider;
    }

    public function setProvider(?Access $provider): self
    {
        $this->provider = $provider;

        return $this;
    }

    public function getEquipment(): ?Equipment
    {
        return $this->equipment;
    }

    public function setEquipment(?Equipment $equipment): self
    {
        $this->equipment = $equipment;

        return $this;
    }
}
