<?php

namespace App\Entity;

use App\Repository\AttestationEntretienPointControleRepository;
use Doctrine\ORM\Mapping as ORM;
use Symfony\Component\Serializer\Annotation\Groups;

/**
 * @ORM\Entity(repositoryClass=AttestationEntretienPointControleRepository::class)
 * @ORM\Table(schema="sav")
 */
class AttestationEntretienPointControle
{

    /**
     * @ORM\Id
     * @ORM\ManyToOne(targetEntity=AttestationEntretien::class, inversedBy="attestationEntretienPointControles")
     * @ORM\JoinColumn(nullable=false, name="idattestation_entretien")
     */
    private $attestation_entretien;

    /**
     * @ORM\Id
     * @ORM\ManyToOne(targetEntity=PointControle::class, inversedBy="attestationEntretienPointControles")
     * @ORM\JoinColumn(nullable=false, name="idpoint_controle")
     * @Groups({"api"})
     */
    private $point_controle;

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

    /**
     * @ORM\ManyToOne(targetEntity=MotifDebitGaz::class, inversedBy="attestationEntretienPointControles")
     * @ORM\JoinColumn(nullable=false, name="idmotif_debit_gaz")
     * @Groups({"api"})
     */
    private $motif_debit_gaz;

    public static function create(AttestationEntretien $attestation, PointControle $pointControle, $valeur, MotifDebitGaz $motifDebitGaz = null) {
        $attestationEntretienPointControle = new AttestationEntretienPointControle();

        $attestationEntretienPointControle
            ->setAttestationEntretien($attestation)
            ->setPointControle($pointControle)
            ->setValeur($valeur)
            ->setMotifDebitGaz($motifDebitGaz)
        ;
        return $attestationEntretienPointControle;
    }

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

    public function getAttestationEntretien(): ?AttestationEntretien
    {
        return $this->attestation_entretien;
    }

    public function setAttestationEntretien(?AttestationEntretien $attestation_entretien): self
    {
        $this->attestation_entretien = $attestation_entretien;

        return $this;
    }

    public function getPointControle(): ?PointControle
    {
        return $this->point_controle;
    }

    public function setPointControle(?PointControle $point_controle): self
    {
        $this->point_controle = $point_controle;

        return $this;
    }

    public function getValeur(): ?string
    {
        return $this->valeur;
    }

    public function setValeur(?string $valeur): self
    {
        $this->valeur = $valeur;

        return $this;
    }

    public function getMotifDebitGaz(): ?MotifDebitGaz
    {
        return $this->motif_debit_gaz;
    }

    public function setMotifDebitGaz(?MotifDebitGaz $motif_debit_gaz): self
    {
        $this->motif_debit_gaz = $motif_debit_gaz;

        return $this;
    }
}
