<?php

/*
 * This file is part of the VitiCore 2.
 *
 * (c) CP Creation <web@cpcreation.fr>
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */

namespace CpCreation\VitiCore\Contact\Model;

use CpCreation\VitiCore\Behavior\HasFile;
use CpCreation\VitiCore\Behavior\HasImage;
use CpCreation\VitiCore\Behavior\HasTimestamp;
use CpCreation\VitiCore\Behavior\Impl\File;
use CpCreation\VitiCore\Behavior\Impl\Image;
use CpCreation\VitiCore\Behavior\Impl\Timestamp;
use Doctrine\ORM\Mapping as ORM;
use Ramsey\Uuid\Uuid;
use Ramsey\Uuid\UuidInterface;
use Symfony\Component\Validator\Constraints as Assert;

#[ORM\Entity(repositoryClass: 'CpCreation\VitiCore\Contact\Repository\ContactRepository')]
#[ORM\Table(name: 'contact_contact')]
#[ORM\HasLifecycleCallbacks]
class Contact implements HasTimestamp, HasFile, HasImage
{
    use File;
    use Image;
    use Timestamp;

    #[ORM\Id]
    #[ORM\Column(type: 'uuid')]
    #[ORM\GeneratedValue(strategy: 'NONE')]
    private UuidInterface $id;

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

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

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

    #[ORM\Column(type: 'text')]
    #[Assert\NotBlank]
    private string $address;

    #[ORM\Column(type: 'text')]
    #[Assert\NotBlank]
    private string $postal;

    #[ORM\Column(type: 'text')]
    #[Assert\NotBlank]
    private string $city;

    #[ORM\Column(length: 2, options: ['default' => 'FR'])]
    #[Assert\Country]
    private string $country = 'FR';

    #[ORM\Column(type: 'decimal', precision: 10, scale: 7, nullable: true)]
    #[Assert\Range(min: -90, max: 90)]
    private ?string $latitude = null;

    #[ORM\Column(type: 'decimal', precision: 10, scale: 7, nullable: true)]
    #[Assert\Range(min: -180, max: 180)]
    private ?string $longitude = null;

    /**
     * @var list<array{dayOfWeek: list<string>, opens: string, closes: string}>
     */
    #[ORM\Column(type: 'json', options: ['default' => '[]'])]
    private array $openingHours = [];

    #[ORM\Column(type: 'text')]
    #[Assert\NotBlank]
    private string $phone1;

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

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

    #[ORM\Column(type: 'text')]
    #[Assert\NotBlank]
    #[Assert\Email]
    private string $emailFrom;

    #[ORM\Column(type: 'text')]
    #[Assert\NotBlank]
    #[Assert\Email]
    private string $emailToMessage;

    #[ORM\Column(type: 'text')]
    #[Assert\NotBlank]
    #[Assert\Email]
    private string $emailToShop;

    #[ORM\Column(type: 'text', nullable: true)]
    #[Assert\Url]
    private ?string $facebook = null;

    #[ORM\Column(type: 'text', nullable: true)]
    #[Assert\Url]
    private ?string $instagram = null;

    #[ORM\Column(type: 'text', nullable: true)]
    #[Assert\Url]
    private ?string $twitter = null;

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

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

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

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

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

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

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

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

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

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

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

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

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

    public function __construct()
    {
        $this->id = Uuid::uuid4();
    }

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

    public function getCompany(): ?string
    {
        return $this->company;
    }

    public function setCompany(string $company): void
    {
        $this->company = $company;
    }

    public function getFirstname(): ?string
    {
        return $this->firstname;
    }

    public function setFirstname(?string $firstname): void
    {
        $this->firstname = $firstname;
    }

    public function getLastname(): ?string
    {
        return $this->lastname;
    }

    public function setLastname(?string $lastname): void
    {
        $this->lastname = $lastname;
    }

    public function getPostal(): ?string
    {
        return $this->postal;
    }

    public function setPostal(string $postal): void
    {
        $this->postal = $postal;
    }

    public function getCity(): ?string
    {
        return $this->city;
    }

    public function setCity(string $city): void
    {
        $this->city = $city;
    }

    public function getAddress(): ?string
    {
        return $this->address;
    }

    public function setAddress(string $address): void
    {
        $this->address = $address;
    }

    public function getCountry(): string
    {
        return $this->country;
    }

    public function setCountry(string $country): void
    {
        $this->country = strtoupper($country);
    }

    public function getLatitude(): ?string
    {
        return $this->latitude;
    }

    public function setLatitude(?string $latitude): void
    {
        $this->latitude = $latitude;
    }

    public function getLongitude(): ?string
    {
        return $this->longitude;
    }

    public function setLongitude(?string $longitude): void
    {
        $this->longitude = $longitude;
    }

    /**
     * @return list<array{dayOfWeek: list<string>, opens: string, closes: string}>
     */
    public function getOpeningHours(): array
    {
        return $this->openingHours;
    }

    /**
     * @param list<array{dayOfWeek: list<string>, opens: string, closes: string}> $openingHours
     */
    public function setOpeningHours(array $openingHours): void
    {
        $this->openingHours = array_values($openingHours);
    }

    public function getPhone1(): ?string
    {
        return $this->phone1;
    }

    public function setPhone1(string $phone1): void
    {
        $this->phone1 = $phone1;
    }

    public function getPhone2(): ?string
    {
        return $this->phone2;
    }

    public function setPhone2(?string $phone2): void
    {
        $this->phone2 = $phone2;
    }

    public function getPhone3(): ?string
    {
        return $this->phone3;
    }

    public function setPhone3(?string $phone3): void
    {
        $this->phone3 = $phone3;
    }

    public function getEmailFrom(): ?string
    {
        return $this->emailFrom;
    }

    public function setEmailFrom(string $emailFrom): void
    {
        $this->emailFrom = $emailFrom;
    }

    public function getEmailToMessage(): ?string
    {
        return $this->emailToMessage;
    }

    public function setEmailToMessage(string $emailToMessage): void
    {
        $this->emailToMessage = $emailToMessage;
    }

    public function getEmailToShop(): ?string
    {
        return $this->emailToShop;
    }

    public function setEmailToShop(string $emailToShop): void
    {
        $this->emailToShop = $emailToShop;
    }

    public function getFacebook(): ?string
    {
        return $this->facebook;
    }

    public function setFacebook(?string $facebook): void
    {
        $this->facebook = $facebook;
    }

    public function getInstagram(): ?string
    {
        return $this->instagram;
    }

    public function setInstagram(?string $instagram): void
    {
        $this->instagram = $instagram;
    }

    public function getTwitter(): ?string
    {
        return $this->twitter;
    }

    public function setTwitter(?string $twitter): void
    {
        $this->twitter = $twitter;
    }

    public function getEditorCompany(): ?string
    {
        return $this->editorCompany;
    }

    public function setEditorCompany(?string $editorCompany): void
    {
        $this->editorCompany = $editorCompany;
    }

    public function getEditorRcs(): ?string
    {
        return $this->editorRcs;
    }

    public function setEditorRcs(?string $editorRcs): void
    {
        $this->editorRcs = $editorRcs;
    }

    public function getEditorTva(): ?string
    {
        return $this->editorTva;
    }

    public function setEditorTva(?string $editorTva): void
    {
        $this->editorTva = $editorTva;
    }

    public function getEditorAddress(): ?string
    {
        return $this->editorAddress;
    }

    public function setEditorAddress(?string $editorAddress): void
    {
        $this->editorAddress = $editorAddress;
    }

    public function getEditorPostal(): ?string
    {
        return $this->editorPostal;
    }

    public function setEditorPostal(?string $editorPostal): void
    {
        $this->editorPostal = $editorPostal;
    }

    public function getEditorCity(): ?string
    {
        return $this->editorCity;
    }

    public function setEditorCity(?string $editorCity): void
    {
        $this->editorCity = $editorCity;
    }

    public function getCgv(): ?string
    {
        return $this->cgv;
    }

    public function setCgv(?string $cgv): void
    {
        $this->cgv = $cgv;
    }

    public function getLegalNoticeContent(): ?string
    {
        return $this->legalNoticeContent;
    }

    public function setLegalNoticeContent(?string $legalNoticeContent): void
    {
        $this->legalNoticeContent = $legalNoticeContent;
    }

    public function getPrivacyPolicyContent(): ?string
    {
        return $this->privacyPolicyContent;
    }

    public function setPrivacyPolicyContent(?string $privacyPolicyContent): void
    {
        $this->privacyPolicyContent = $privacyPolicyContent;
    }

    public function getLegalNoticeExtraParagraph(): ?string
    {
        return $this->legalNoticeExtraParagraph;
    }

    public function setLegalNoticeExtraParagraph(?string $legalNoticeExtraParagraph): void
    {
        $this->legalNoticeExtraParagraph = $legalNoticeExtraParagraph;
    }

    public function getPrivacyPolicyExtraParagraph(): ?string
    {
        return $this->privacyPolicyExtraParagraph;
    }

    public function setPrivacyPolicyExtraParagraph(?string $privacyPolicyExtraParagraph): void
    {
        $this->privacyPolicyExtraParagraph = $privacyPolicyExtraParagraph;
    }

    public function getCommitteeChampagneSiret(): ?string
    {
        return $this->committeeChampagneSiret;
    }

    public function setCommitteeChampagneSiret(?string $committeeChampagneSiret): void
    {
        $this->committeeChampagneSiret = $committeeChampagneSiret;
    }

    public function getCommitteeChampagneIdentifiant(): ?string
    {
        return $this->committeeChampagneIdentifiant;
    }

    public function setCommitteeChampagneIdentifiant(?string $committeeChampagneIdentifiant): void
    {
        $this->committeeChampagneIdentifiant = $committeeChampagneIdentifiant;
    }
}
