<?php

namespace App\Entity;

use App\Repository\ProduitFactureAffectationRepository;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
use Symfony\Component\Serializer\Annotation\Groups;

/**
 * @ORM\Entity(repositoryClass=ProduitFactureAffectationRepository::class)
 * @ORM\Table(schema="sav")
 */
class ProduitFactureAffectation
{
    /**
     * @ORM\Id
     * @ORM\GeneratedValue
     * @ORM\Column(type="integer")
     * @Groups({"api"})
     */
    private $id;

    /**
     * @ORM\Column(type="string", length=3, nullable=true)
     * @Groups({"api"})
     */
    private $libelle_court;

    /**
     * @ORM\Column(type="string", length=25, nullable=true)
     * @Groups({"api"})
     */
    private $libelle_long;

    /**
     * @ORM\OneToMany(targetEntity=FactureLigne::class, mappedBy="produit_facture_affectation")
     */
    private $factureLignes;

    /**
     * @ORM\OneToMany(targetEntity=DevisLigne::class, mappedBy="produit_facture_affectation")
     */
    private $devisLignes;

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

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

    public function setId(?int $id): self
    {
        $this->id = $id;

        return $this;
    }

    public function getLibelleCourt(): ?string
    {
        return $this->libelle_court;
    }

    public function setLibelleCourt(?string $libelle_court): self
    {
        $this->libelle_court = $libelle_court;

        return $this;
    }

    public function getLibelleLong(): ?string
    {
        return $this->libelle_long;
    }

    public function setLibelleLong(?string $libelle_long): self
    {
        $this->libelle_long = $libelle_long;

        return $this;
    }

    /**
     * @return Collection<int, FactureLigne>
     */
    public function getFactureLignes(): Collection
    {
        return $this->factureLignes;
    }

    public function addFactureLigne(FactureLigne $factureLigne): self
    {
        if (!$this->factureLignes->contains($factureLigne)) {
            $this->factureLignes[] = $factureLigne;
            $factureLigne->setProduitFactureAffectation($this);
        }

        return $this;
    }

    public function removeFactureLigne(FactureLigne $factureLigne): self
    {
        if ($this->factureLignes->removeElement($factureLigne)) {
            // set the owning side to null (unless already changed)
            if ($factureLigne->getProduitFactureAffectation() === $this) {
                $factureLigne->setProduitFactureAffectation(null);
            }
        }

        return $this;
    }

    /**
     * @return Collection<int, DevisLigne>
     */
    public function getDevisLignes(): Collection
    {
        return $this->devisLignes;
    }

    public function addDevisLigne(DevisLigne $devisLigne): self
    {
        if (!$this->devisLignes->contains($devisLigne)) {
            $this->devisLignes[] = $devisLigne;
            $devisLigne->setProduitFactureAffectation($this);
        }

        return $this;
    }

    public function removeDevisLigne(DevisLigne $devisLigne): self
    {
        if ($this->devisLignes->removeElement($devisLigne)) {
            // set the owning side to null (unless already changed)
            if ($devisLigne->getProduitFactureAffectation() === $this) {
                $devisLigne->setProduitFactureAffectation(null);
            }
        }

        return $this;
    }
}
