<?php

namespace App\Entity;

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

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

    #[ORM\Column(length: 255, unique: true)]
    private ?string $uuid = null;

    #[ORM\Column(type: Types::JSON)]
    private array $products = [];

    #[ORM\Column(type: Types::JSON, nullable: true)]
    private array $options = [];

    #[ORM\ManyToOne(inversedBy: 'orderSessions')]
    private ?Customer $customer = null;

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

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

    #[ORM\Column(length: 50)]
    private string $state = 'created';

    #[ORM\Column(length: 255, nullable: true)]
    private ?string $billingAddress = null;

    #[ORM\Column(length: 255, nullable: true)]
    private ?string $billingZipCode = null;

    #[ORM\Column(length: 255, nullable: true)]
    private ?string $billingTown = null;

    #[ORM\Column(length: 255, nullable: true)]
    private ?string $adressEvent = null;

    #[ORM\Column(length: 255, nullable: true)]
    private ?string $adress2Event = null;

    #[ORM\Column(length: 255, nullable: true)]
    private ?string $adress3Event = null;

    #[ORM\Column(length: 255, nullable: true)]
    private ?string $zipCodeEvent = null;

    #[ORM\Column(length: 255, nullable: true)]
    private ?string $townEvent = null;

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

    #[ORM\Column(type: Types::TEXT, nullable: true)]
    private ?string $details = null;

    #[ORM\Column(length: 255, nullable: true)]
    private ?string $typeSol = null;

    #[ORM\Column(length: 255, nullable: true)]
    private ?string $pente = null;

    #[ORM\Column(type: Types::TEXT, nullable: true)]
    private ?string $access = null;

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

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

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

    #[ORM\Column(type: Types::JSON, nullable: true)]
    private ?array $deliveryGeometry = null;

    #[ORM\Column(length: 255, nullable: true)]
    private ?string $typePaiement = null;

    #[ORM\Column(type: Types::JSON, nullable: true)]
    private ?array $promotion = null;

    #[ORM\ManyToOne(targetEntity: Formules::class)]
    private ?Formules $formule = null;

    #[ORM\OneToOne(mappedBy: 'orderSession', cascade: ['persist', 'remove'])]
    private ?Devis $devis = null;

    #[ORM\ManyToOne(inversedBy: 'orderSessions')]
    private ?Prestaire $prestataire = null;

    public function __construct()
    {
        $this->createdAt = new \DateTimeImmutable();
        $this->products = [];
        $this->options = [];
        $this->state = 'created';
    }

    public function getDevis(): ?Devis
    {
        return $this->devis;
    }

    public function setDevis(?Devis $devis): static
    {
        // unset the owning side of the relation if necessary
        if ($devis === null && $this->devis !== null) {
            $this->devis->setOrderSession(null);
        }

        // set the owning side of the relation if necessary
        if ($devis !== null && $devis->getOrderSession() !== $this) {
            $devis->setOrderSession($this);
        }

        $this->devis = $devis;

        return $this;
    }

    public function getPrestataire(): ?Prestaire
    {
        return $this->prestataire;
    }

    public function setPrestataire(?Prestaire $prestataire): static
    {
        $this->prestataire = $prestataire;

        return $this;
    }

    #[ORM\PrePersist]
    public function setCreatedAtValue(): void
    {
        $this->createdAt = new \DateTimeImmutable();
    }

    #[ORM\PreUpdate]
    public function setUpdatedAtValue(): void
    {
        $this->updatedAt = new \DateTimeImmutable();
    }

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

    public function getUuid(): ?string
    {
        return $this->uuid;
    }

    public function setUuid(string $uuid): static
    {
        $this->uuid = $uuid;

        return $this;
    }

    public function getState(): string
    {
        return $this->state;
    }

    public function setState(string $state): static
    {
        $this->state = $state;

        return $this;
    }

    public function getProducts(): array
    {
        return $this->products;
    }

    public function setProducts(array $products): static
    {
        $this->products = $products;

        return $this;
    }

    public function getOptions(): array
    {
        return $this->options;
    }

    public function setOptions(?array $options): static
    {
        $this->options = $options;

        return $this;
    }

    public function getCustomer(): ?Customer
    {
        return $this->customer;
    }

    public function setCustomer(?Customer $customer): static
    {
        $this->customer = $customer;

        return $this;
    }

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

    public function setCreatedAt(\DateTimeImmutable $createdAt): static
    {
        $this->createdAt = $createdAt;

        return $this;
    }

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

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

        return $this;
    }

    public function getBillingAddress(): ?string
    {
        return $this->billingAddress;
    }

    public function setBillingAddress(?string $billingAddress): static
    {
        $this->billingAddress = $billingAddress;

        return $this;
    }

    public function getBillingZipCode(): ?string
    {
        return $this->billingZipCode;
    }

    public function setBillingZipCode(?string $billingZipCode): static
    {
        $this->billingZipCode = $billingZipCode;

        return $this;
    }

    public function getBillingTown(): ?string
    {
        return $this->billingTown;
    }

    public function setBillingTown(?string $billingTown): static
    {
        $this->billingTown = $billingTown;

        return $this;
    }

    public function getAdressEvent(): ?string
    {
        return $this->adressEvent;
    }

    public function setAdressEvent(?string $adressEvent): static
    {
        $this->adressEvent = $adressEvent;

        return $this;
    }

    public function getAdress2Event(): ?string
    {
        return $this->adress2Event;
    }

    public function setAdress2Event(?string $adress2Event): static
    {
        $this->adress2Event = $adress2Event;

        return $this;
    }

    public function getAdress3Event(): ?string
    {
        return $this->adress3Event;
    }

    public function setAdress3Event(?string $adress3Event): static
    {
        $this->adress3Event = $adress3Event;

        return $this;
    }

    public function getZipCodeEvent(): ?string
    {
        return $this->zipCodeEvent;
    }

    public function setZipCodeEvent(?string $zipCodeEvent): static
    {
        $this->zipCodeEvent = $zipCodeEvent;

        return $this;
    }

    public function getTownEvent(): ?string
    {
        return $this->townEvent;
    }

    public function setTownEvent(?string $townEvent): static
    {
        $this->townEvent = $townEvent;

        return $this;
    }

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

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

        return $this;
    }

    public function getDetails(): ?string
    {
        return $this->details;
    }

    public function setDetails(?string $details): static
    {
        $this->details = $details;

        return $this;
    }

    public function getTypeSol(): ?string
    {
        return $this->typeSol;
    }

    public function setTypeSol(?string $typeSol): static
    {
        $this->typeSol = $typeSol;

        return $this;
    }

    public function getPente(): ?string
    {
        return $this->pente;
    }

    public function setPente(?string $pente): static
    {
        $this->pente = $pente;

        return $this;
    }

    public function getAccess(): ?string
    {
        return $this->access;
    }

    public function setAccess(?string $access): static
    {
        $this->access = $access;

        return $this;
    }

    public function getDistancePower(): ?float
    {
        return $this->distancePower;
    }

    public function setDistancePower(?float $distancePower): static
    {
        $this->distancePower = $distancePower;

        return $this;
    }

    public function getDeliveryDistance(): ?float
    {
        return $this->deliveryDistance;
    }

    public function setDeliveryDistance(?float $deliveryDistance): static
    {
        $this->deliveryDistance = $deliveryDistance;

        return $this;
    }

    public function getDeliveryPrice(): ?float
    {
        return $this->deliveryPrice;
    }

    public function setDeliveryPrice(?float $deliveryPrice): static
    {
        $this->deliveryPrice = $deliveryPrice;

        return $this;
    }

    public function getDeliveryGeometry(): ?array
    {
        return $this->deliveryGeometry;
    }

    public function setDeliveryGeometry(?array $deliveryGeometry): static
    {
        $this->deliveryGeometry = $deliveryGeometry;

        return $this;
    }

    public function getTypePaiement(): ?string
    {
        return $this->typePaiement;
    }

    public function setTypePaiement(?string $typePaiement): static
    {
        $this->typePaiement = $typePaiement;

        return $this;
    }

    public function getPromotion(): ?array
    {
        return $this->promotion;
    }

    public function setPromotion(?array $promotion): static
    {
        $this->promotion = $promotion;

        return $this;
    }

    public function getFormule(): ?Formules
    {
        return $this->formule;
    }

    public function setFormule(?Formules $formule): static
    {
        $this->formule = $formule;

        return $this;
    }
}
