<?php

declare(strict_types=1);

/*
 * 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\Product\Model\Translation;

use CpCreation\VitiCore\Behavior\Impl\Translation;
use Doctrine\ORM\Mapping as ORM;
use Gedmo\Mapping\Annotation as Gedmo;
use Knp\DoctrineBehaviors\Contract\Entity\TranslationInterface;
use Ramsey\Uuid\Uuid;
use Ramsey\Uuid\UuidInterface;
use Symfony\Component\Validator\Constraints as Assert;

#[ORM\Entity]
#[ORM\Table(name: 'product_product_translation')]
class ProductTranslation implements TranslationInterface
{
    use Translation;

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

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

    #[ORM\Column(type: 'text')]
    #[Assert\NotBlank]
    private ?string $name = null;

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

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

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

    #[ORM\Column(type: 'string', length: 255, unique: true)]
    #[Gedmo\Slug(fields: ['name', 'quality'])]
    private ?string $slug = null;

    #[ORM\Column(type: 'text')]
    #[Assert\NotBlank]
    private ?string $description = null;

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

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

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

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

    #[ORM\Column(type: 'json', nullable: true)]
    private ?array $assemblages = null;

    #[ORM\Column(type: 'json', nullable: true)]
    private ?array $winemaking = null;

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

    #[ORM\Column(type: 'boolean')]
    private bool $showInfoShopOnlyOnPanel = false;

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

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

    public function getHeader(): ?string
    {
        return $this->header;
    }

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

    public function getName(): ?string
    {
        return $this->name;
    }

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

    public function getOtherText1(): ?string
    {
        return $this->otherText1;
    }

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

    public function getRibbonCustom(): ?string
    {
        return $this->ribbonCustom;
    }

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

    public function getQuality(): ?string
    {
        return $this->quality;
    }

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

    public function getSlug(): ?string
    {
        return $this->slug;
    }

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

    public function getDescription(): ?string
    {
        return $this->description;
    }

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

    public function getIntroText(): ?string
    {
        return $this->introText;
    }

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

    public function getInfoShop(): ?string
    {
        return $this->infoShop;
    }

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

    public function getDosage(): ?string
    {
        return $this->dosage;
    }

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

    public function getTasting(): ?string
    {
        return $this->tasting;
    }

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

    public function getAssemblages(): ?array
    {
        return $this->assemblages;
    }

    public function setAssemblages(?array $assemblages): void
    {
        $this->assemblages = $assemblages;
    }

    public function getWinemaking(): ?array
    {
        return $this->winemaking;
    }

    public function setWinemaking(?array $winemaking): void
    {
        $this->winemaking = $winemaking;
    }

    public function getSelectVariant(): ?string
    {
        return $this->selectVariant;
    }

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

    public function getFullName(): string
    {
        $fullName = '';

        if ($this->getHeader()) {
            $fullName = $this->getHeader().' ';
        }

        $fullName .= $this->getName() ?? '';

        if ($this->getQuality()) {
            $fullName .= ' '.$this->getQuality();
        }

        return $fullName;
    }

    public function isShowInfoShopOnlyOnPanel(): bool
    {
        return $this->showInfoShopOnlyOnPanel;
    }

    public function setShowInfoShopOnlyOnPanel(bool $showInfoShopOnlyOnPanel): void
    {
        $this->showInfoShopOnlyOnPanel = $showInfoShopOnlyOnPanel;
    }
}
