<?php

namespace App\Entity;

use App\Repository\FactureRepository;
use Doctrine\ORM\Mapping as ORM;
use Symfony\Component\HttpFoundation\File\File;
use Vich\UploaderBundle\Mapping\Attribute\Uploadable;
use Vich\UploaderBundle\Mapping\Attribute\UploadableField;

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

    #[ORM\OneToOne(inversedBy: 'facture', cascade: ['persist', 'remove'])]
    private ?Contrats $contrat = null;

    #[ORM\Column(length: 255)]
    private ?string $num = null;

    #[ORM\Column]
    private ?\DateTimeImmutable $createAt = null;

    #[ORM\Column]
    private ?\DateTimeImmutable $updateAt = null;

    #[UploadableField(mapping: 'contrat_docuseal', fileNameProperty: 'factureFileName', size: 'factureFileSize')]
    private ?File $factureFile = null;
    #[ORM\Column(nullable: true)]
    private ?string $factureFileName = null;
    #[ORM\Column(nullable: true)]
    private ?int $factureFileSize = null;
    public function getId(): ?int
    {
        return $this->id;
    }

    public function getContrat(): ?Contrats
    {
        return $this->contrat;
    }

    public function setContrat(?Contrats $contrat): static
    {
        $this->contrat = $contrat;

        return $this;
    }

    public function getNum(): ?string
    {
        return $this->num;
    }

    public function setNum(string $num): static
    {
        $this->num = $num;

        return $this;
    }

    public function getCreateAt(): ?\DateTimeImmutable
    {
        return $this->createAt;
    }

    public function setCreateAt(\DateTimeImmutable $createAt): static
    {
        $this->createAt = $createAt;

        return $this;
    }

    public function getUpdateAt(): ?\DateTimeImmutable
    {
        return $this->updateAt;
    }

    public function setUpdateAt(\DateTimeImmutable $updateAt): static
    {
        $this->updateAt = $updateAt;

        return $this;
    }

    /**
     * @return string|null
     */
    public function getFactureFileName(): ?string
    {
        return $this->factureFileName;
    }

    /**
     * @return File|null
     */
    public function getFactureFile(): ?File
    {
        return $this->factureFile;
    }

    /**
     * @return int|null
     */
    public function getFactureFileSize(): ?int
    {
        return $this->factureFileSize;
    }

    /**
     * @param string|null $factureFileName
     */
    public function setFactureFileName(?string $factureFileName): void
    {
        $this->factureFileName = $factureFileName;
    }

    /**
     * @param File|null $factureFile
     */
    public function setFactureFile(?File $factureFile): void
    {
        $this->factureFile = $factureFile;
    }

    /**
     * @param int|null $factureFileSize
     */
    public function setFactureFileSize(?int $factureFileSize): void
    {
        $this->factureFileSize = $factureFileSize;
    }
}
