<?php

namespace App\Entity\Ag;

use App\Entity\Members;
use App\Repository\Ag\MainRepository;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
use Symfony\Component\HttpFoundation\File\File;
use Vich\UploaderBundle\Mapping\Annotation as Vich;

#[ORM\Entity(repositoryClass: MainRepository::class)]
#[ORM\Table(name: 'ag_main')]
#[Vich\Uploadable()]
class Main
{
    #[ORM\Id]
    #[ORM\GeneratedValue]
    #[ORM\Column]
    private ?int $id = null;

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

    #[ORM\ManyToOne(inversedBy: 'ag_president')]
    private ?Members $president = null;

    #[ORM\ManyToOne(inversedBy: 'secretaire')]
    private ?Members $secretaire = null;

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

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

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

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

    /**
     * @var Collection<int, MainMember>
     */
    #[ORM\OneToMany(targetEntity: MainMember::class, mappedBy: 'main')]
    private Collection $mainMembers;

    #[ORM\Column(nullable: true)]
    private ?\DateTimeImmutable $closedAt = null;

    /**
     * @var Collection<int, MainOrder>
     */
    #[ORM\OneToMany(targetEntity: MainOrder::class, mappedBy: 'main')]
    private Collection $orders;

    #[ORM\Column(nullable: true)]
    private ?bool $isClosed = null;

    /**
     * @var Collection<int, MainVote>
     */
    #[ORM\OneToMany(targetEntity: MainVote::class, mappedBy: 'main')]
    private Collection $mainVote;


    #[Vich\UploadableField(mapping: 'ag',fileNameProperty: 'agFileName', size: 'agSize', mimeType: 'agMineType', originalName: 'agOriginalName',dimensions: 'agDimensions')]
    private ?File $ag = null;

    #[ORM\Column(nullable: true)]
    private ?string $agFileName = null;
    #[ORM\Column(nullable: true)]
    private ?array $agDimensions = [];
    #[ORM\Column(length: 255,nullable: true)]
    private ?string $agSize = null;
    #[ORM\Column(length: 255,nullable: true)]
    private ?string $agMineType = null;
    #[ORM\Column(length: 255,nullable: true)]
    private ?string $agOriginalName = null;


    #[Vich\UploadableField(mapping: 'ag_adh',fileNameProperty: 'agAdhFileName', size: 'agAdhSize', mimeType: 'agAdhMineType', originalName: 'agAdhOriginalName',dimensions: 'agAdhDimensions')]
    private ?File $agAdh = null;

    #[ORM\Column(nullable: true)]
    private ?string $agAdhFileName = null;
    #[ORM\Column(nullable: true)]
    private ?array $agAdhDimensions = [];
    #[ORM\Column(length: 255,nullable: true)]
    private ?string $agAdhSize = null;
    #[ORM\Column(length: 255,nullable: true)]
    private ?string $agAdhMineType = null;
    #[ORM\Column(length: 255,nullable: true)]
    private ?string $agAdhOriginalName = null;
    #[ORM\Column(nullable: true)]
    private ?\DateTimeImmutable $updateAt;

    #[ORM\Column(nullable: true)]
    private ?bool $isSigned = null;

    #[ORM\Column(nullable: true)]
    private ?string $submiterId = null;

    #[ORM\Column(nullable: true)]
    private ?bool $isAttestation = null;

    /**
     * @var Collection<int, MainSigned>
     */
    #[ORM\OneToMany(targetEntity: MainSigned::class, mappedBy: 'main')]
    private Collection $mainSigneds;
    /**
     * @return File|null
     */
    public function getAg(): ?File
    {
        return $this->ag;
    }

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

    public function __construct()
    {
        $this->mainMembers = new ArrayCollection();
        $this->orders = new ArrayCollection();
        $this->mainVote = new ArrayCollection();
        $this->mainSigneds = new ArrayCollection();
    }

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

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

    public function setAgDateAt(\DateTimeImmutable $agDateAt): static
    {
        $this->agDateAt = $agDateAt;

        return $this;
    }

    public function getPresident(): ?Members
    {
        return $this->president;
    }

    public function setPresident(?Members $president): static
    {
        $this->president = $president;

        return $this;
    }

    public function getSecretaire(): ?Members
    {
        return $this->secretaire;
    }

    public function setSecretaire(?Members $secretaire): static
    {
        $this->secretaire = $secretaire;

        return $this;
    }

    public function getLocate(): ?string
    {
        return $this->locate;
    }

    public function setLocate(string $locate): static
    {
        $this->locate = $locate;

        return $this;
    }

    public function getLocateZipcode(): ?string
    {
        return $this->locateZipcode;
    }

    public function setLocateZipcode(string $locateZipcode): static
    {
        $this->locateZipcode = $locateZipcode;

        return $this;
    }

    public function getLocateCity(): ?string
    {
        return $this->locateCity;
    }

    public function setLocateCity(string $locateCity): static
    {
        $this->locateCity = $locateCity;

        return $this;
    }

    public function getType(): ?string
    {
        return $this->type;
    }

    public function setType(string $type): static
    {
        $this->type = $type;

        return $this;
    }

    /**
     * @return Collection<int, MainMember>
     */
    public function getMainMembers(): Collection
    {
        return $this->mainMembers;
    }

    public function addMainMember(MainMember $mainMember): static
    {
        if (!$this->mainMembers->contains($mainMember)) {
            $this->mainMembers->add($mainMember);
            $mainMember->setMain($this);
        }

        return $this;
    }

    public function removeMainMember(MainMember $mainMember): static
    {
        if ($this->mainMembers->removeElement($mainMember)) {
            // set the owning side to null (unless already changed)
            if ($mainMember->getMain() === $this) {
                $mainMember->setMain(null);
            }
        }

        return $this;
    }

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

    public function setClosedAt(?\DateTimeImmutable $closedAt): static
    {
        $this->closedAt = $closedAt;

        return $this;
    }

    /**
     * @return Collection<int, MainOrder>
     */
    public function getOrders(): Collection
    {
        return $this->orders;
    }

    public function addOrder(MainOrder $order): static
    {
        if (!$this->orders->contains($order)) {
            $this->orders->add($order);
            $order->setMain($this);
        }

        return $this;
    }

    public function removeOrder(MainOrder $order): static
    {
        if ($this->orders->removeElement($order)) {
            // set the owning side to null (unless already changed)
            if ($order->getMain() === $this) {
                $order->setMain(null);
            }
        }

        return $this;
    }

    public function isClosed(): ?bool
    {
        return $this->isClosed;
    }

    public function setIsClosed(?bool $isClosed): static
    {
        $this->isClosed = $isClosed;

        return $this;
    }

    /**
     * @return Collection<int, MainVote>
     */
    public function getMainVote(): Collection
    {
        return $this->mainVote;
    }

    public function addMainVote(MainVote $mainVote): static
    {
        if (!$this->mainVote->contains($mainVote)) {
            $this->mainVote->add($mainVote);
            $mainVote->setMain($this);
        }

        return $this;
    }

    public function removeMainVote(MainVote $mainVote): static
    {
        if ($this->mainVote->removeElement($mainVote)) {
            // set the owning side to null (unless already changed)
            if ($mainVote->getMain() === $this) {
                $mainVote->setMain(null);
            }
        }

        return $this;
    }

    /**
     * @return \DateTimeImmutable|null
     */
    public function getUpdateAt(): ?\DateTimeImmutable
    {
        return $this->updateAt;
    }

    /**
     * @return array|null
     */
    public function getAgDimensions(): ?array
    {
        return $this->agDimensions;
    }

    /**
     * @return bool|null
     */
    public function getIsClosed(): ?bool
    {
        return $this->isClosed;
    }

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

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

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

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

    /**
     * @param \DateTimeImmutable|null $updateAt
     */
    public function setUpdateAt(?\DateTimeImmutable $updateAt): void
    {
        $this->updateAt = $updateAt;
    }

    /**
     * @param array|null $agDimensions
     */
    public function setAgDimensions(?array $agDimensions): void
    {
        $this->agDimensions = $agDimensions;
    }

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

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

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

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

    public function isSigned(): ?bool
    {
        return $this->isSigned;
    }

    public function setIsSigned(?bool $isSigned): static
    {
        $this->isSigned = $isSigned;

        return $this;
    }

    public function getSubmiterId(): ?string
    {
        return $this->submiterId;
    }

    public function setSubmiterId(string $submiterId): static
    {
        $this->submiterId = $submiterId;

        return $this;
    }

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

    /**
     * @return array|null
     */
    public function getAgAdhDimensions(): ?array
    {
        return $this->agAdhDimensions;
    }

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

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

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

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

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

    /**
     * @param array|null $agAdhDimensions
     */
    public function setAgAdhDimensions(?array $agAdhDimensions): void
    {
        $this->agAdhDimensions = $agAdhDimensions;
    }

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

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

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

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

    public function isAttestation(): ?bool
    {
        return $this->isAttestation;
    }

    public function setIsAttestation(bool $isAttestation): static
    {
        $this->isAttestation = $isAttestation;

        return $this;
    }

    /**
     * @return Collection<int, MainSigned>
     */
    public function getMainSigneds(): Collection
    {
        return $this->mainSigneds;
    }

    public function addMainSigned(MainSigned $mainSigned): static
    {
        if (!$this->mainSigneds->contains($mainSigned)) {
            $this->mainSigneds->add($mainSigned);
            $mainSigned->setMain($this);
        }

        return $this;
    }

    public function removeMainSigned(MainSigned $mainSigned): static
    {
        if ($this->mainSigneds->removeElement($mainSigned)) {
            // set the owning side to null (unless already changed)
            if ($mainSigned->getMain() === $this) {
                $mainSigned->setMain(null);
            }
        }

        return $this;
    }
}
