<?php

namespace App\Entity;

use App\Repository\ParrainageRepository;
use Doctrine\DBAL\Types\Types;
use Doctrine\ORM\Mapping as ORM;

#[ORM\Entity(repositoryClass: ParrainageRepository::class)]
class Parrainage
{
    #[ORM\Id]
    #[ORM\GeneratedValue]
    #[ORM\Column]
    private ?int $id = null;

    #[ORM\ManyToOne(inversedBy: 'parrainages')]
    #[ORM\JoinColumn(nullable: false)]
    private ?User $origine = null;

    #[ORM\ManyToOne]
    #[ORM\JoinColumn(nullable: false)]
    private ?User $new = null;

    #[ORM\Column(type: Types::DATETIME_MUTABLE)]
    private ?\DateTimeInterface $add = null;


    public function __construct()
    {
        $this->add = new \DateTime();
    }

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

    public function getOrigine(): ?User
    {
        return $this->origine;
    }

    public function setOrigine(?User $origine): static
    {
        $this->origine = $origine;

        return $this;
    }

    public function getNew(): ?User
    {
        return $this->new;
    }

    public function setNew(?User $new): static
    {
        $this->new = $new;

        return $this;
    }

    public function getAdd(): ?\DateTimeInterface
    {
        return $this->add;
    }

    public function setAdd(\DateTimeInterface $add): static
    {
        $this->add = $add;

        return $this;
    }
}
