<?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\Shop\Model;

use CpCreation\VitiCore\Behavior\HasFile;
use CpCreation\VitiCore\Behavior\HasTimestamp;
use CpCreation\VitiCore\Behavior\HasTranslatable;
use CpCreation\VitiCore\Behavior\Impl\File;
use CpCreation\VitiCore\Behavior\Impl\Timestamp;
use CpCreation\VitiCore\Behavior\Impl\Translatable;
use CpCreation\VitiCore\Media\Model\File as ModelFile;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
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\Shop\Repository\ShippingConfigRepository')]
#[ORM\Table(name: 'shop_shipping_config')]
#[ORM\HasLifecycleCallbacks]
class ShippingConfig implements HasFile, HasTimestamp, HasTranslatable
{
    use File;
    use Timestamp;
    use Translatable;

    /**
     * @var Collection<string, Translation\ShippingConfigTranslation>
     */
    #[Assert\Valid]
    #[ORM\OneToMany(
        targetEntity: Translation\ShippingConfigTranslation::class,
        mappedBy: 'translatable',
        cascade: ['all'],
        indexBy: 'locale',
        orphanRemoval: true
    )]
    protected $translations;

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

    #[ORM\Column(type: 'decimal', precision: 5, scale: 4, nullable: true)]
    private ?string $marginGazoleAuto = null;

    #[ORM\Column(type: 'decimal', precision: 5, scale: 4, nullable: true)]
    private ?string $marginAuto = null;

    #[ORM\Column(type: 'decimal', precision: 5, scale: 4, nullable: true)]
    private ?string $marginClientAuto = null;

    #[ORM\Column(type: 'decimal', precision: 5, scale: 4, nullable: true)]
    private ?string $marginManu = null;

    #[ORM\Column(type: 'decimal', precision: 5, scale: 4, nullable: true)]
    private ?string $marginClientManu = null;

    #[ORM\Column(type: 'decimal', precision: 5, scale: 4, nullable: true)]
    private ?string $tvaManu = null;

    #[ORM\Column(type: 'decimal', precision: 5, scale: 4, nullable: true)]
    private ?string $marginBank = null;

    #[ORM\Column(type: 'integer', nullable: true)]
    private ?int $amountMarginBank = null;

    #[ORM\Column(type: 'integer', nullable: true)]
    private ?int $qtyEquivalencyBottle = null;

    #[ORM\Column(type: 'integer', nullable: true)]
    private ?int $amountMinVDManu = null;

    #[ORM\Column(type: 'integer', nullable: true)]
    private ?int $qtyMinVDManu = null;

    #[ORM\Column(type: 'integer', nullable: true)]
    private ?int $amountByBottleTTC = null;

    #[ORM\Column(type: 'integer', nullable: true)]
    private ?int $amountAutoByBottleTTC = null;

    #[ORM\Column(type: 'integer', nullable: true)]
    private ?int $amountMinVDAuto = null;

    #[ORM\Column(type: 'integer', nullable: true)]
    private ?int $qtyMinVDAuto = null;

    #[ORM\Column(type: 'integer', nullable: true)]
    private ?int $amountVDAuto = null;

    #[ORM\Column(type: 'decimal', precision: 5, scale: 4, nullable: true)]
    private ?string $amountPercentVDAuto = null;

    #[Assert\NotBlank]
    #[ORM\Column(type: 'integer', nullable: false, options: ['default' => 0])]
    private ?int $amountFixedBeforeMargeAuto = 0;

    #[Assert\NotBlank]
    #[ORM\Column(type: 'integer', nullable: false, options: ['default' => 0])]
    private ?int $amountFixedAuto = 0;

    #[Assert\NotBlank]
    #[ORM\Column(type: 'integer', nullable: false, options: ['default' => 0])]
    private ?int $amountFixedManu = 0;

    #[ORM\Column(type: 'integer', nullable: true)]
    private ?int $highMountainAmount = null;

    #[ORM\Column(type: 'integer', nullable: true)]
    private ?int $amountFreeShipping = null;

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

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

    #[ORM\OneToOne(targetEntity: ModelFile::class, cascade: ['persist', 'remove'])]
    private ?ModelFile $fileSup = null;

    public function __construct()
    {
        $this->id = Uuid::uuid4();
        $this->translations = new ArrayCollection();
        $this->forceEquivalencyForAuto = false;
    }

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

    public function getMarginAuto(): ?float
    {
        return null !== $this->marginAuto ? (float) $this->marginAuto : null;
    }

    public function getMarginGazoleAuto(): ?float
    {
        return null !== $this->marginGazoleAuto ? (float) $this->marginGazoleAuto : null;
    }

    public function setMarginGazoleAuto(?float $marginGazoleAuto): void
    {
        $this->marginGazoleAuto = null !== $marginGazoleAuto ? (string) $marginGazoleAuto : null;
    }

    public function setMarginAuto(?float $marginAuto = null): void
    {
        $this->marginAuto = null !== $marginAuto ? (string) $marginAuto : null;
    }

    public function getMarginClientAuto(): ?float
    {
        return null !== $this->marginClientAuto ? (float) $this->marginClientAuto : null;
    }

    public function setMarginClientAuto(?float $marginClientAuto): void
    {
        $this->marginClientAuto = null !== $marginClientAuto ? (string) $marginClientAuto : null;
    }

    public function getMarginManu(): ?float
    {
        return null !== $this->marginManu ? (float) $this->marginManu : null;
    }

    public function setMarginManu(?float $marginManu = null): void
    {
        $this->marginManu = null !== $marginManu ? (string) $marginManu : null;
    }

    public function getMarginClientManu(): ?float
    {
        return null !== $this->marginClientManu ? (float) $this->marginClientManu : null;
    }

    public function setMarginClientManu(?float $marginClientManu): void
    {
        $this->marginClientManu = null !== $marginClientManu ? (string) $marginClientManu : null;
    }

    public function getTvaManu(): ?float
    {
        return null !== $this->tvaManu ? (float) $this->tvaManu : null;
    }

    public function setTvaManu(?float $tvaManu = null): void
    {
        $this->tvaManu = null !== $tvaManu ? (string) $tvaManu : null;
    }

    public function getMarginBank(): ?float
    {
        return null !== $this->marginBank ? (float) $this->marginBank : null;
    }

    public function setMarginBank(?float $marginBank = null): void
    {
        $this->marginBank = null !== $marginBank ? (string) $marginBank : null;
    }

    public function getAmountMarginBank(): ?int
    {
        return $this->amountMarginBank;
    }

    public function setAmountMarginBank(?int $amountMarginBank): void
    {
        $this->amountMarginBank = $amountMarginBank;
    }

    public function getQtyEquivalencyBottle(): ?int
    {
        return $this->qtyEquivalencyBottle;
    }

    public function setQtyEquivalencyBottle(?int $qtyEquivalencyBottle = null): void
    {
        $this->qtyEquivalencyBottle = $qtyEquivalencyBottle;
    }

    public function getAmountMinVDManu(): ?int
    {
        return $this->amountMinVDManu;
    }

    public function setAmountMinVDManu(?int $amountMinVDManu): void
    {
        $this->amountMinVDManu = $amountMinVDManu;
    }

    public function getQtyMinVDManu(): ?int
    {
        return $this->qtyMinVDManu;
    }

    public function setQtyMinVDManu(?int $qtyMinVDManu): void
    {
        $this->qtyMinVDManu = $qtyMinVDManu;
    }

    public function getAmountByBottleTTC(): ?int
    {
        return $this->amountByBottleTTC;
    }

    public function setAmountByBottleTTC(?int $amountByBottleTTC): void
    {
        $this->amountByBottleTTC = $amountByBottleTTC;
    }

    public function getAmountAutoByBottleTTC(): ?int
    {
        return $this->amountAutoByBottleTTC;
    }

    public function setAmountAutoByBottleTTC(?int $amountAutoByBottleTTC): void
    {
        $this->amountAutoByBottleTTC = $amountAutoByBottleTTC;
    }

    public function getAmountMinVDAuto(): ?int
    {
        return $this->amountMinVDAuto;
    }

    public function setAmountMinVDAuto(?int $amountMinVDAuto): void
    {
        $this->amountMinVDAuto = $amountMinVDAuto;
    }

    public function getQtyMinVDAuto(): ?int
    {
        return $this->qtyMinVDAuto;
    }

    public function setQtyMinVDAuto(?int $qtyMinVDAuto): void
    {
        $this->qtyMinVDAuto = $qtyMinVDAuto;
    }

    public function getAmountVDAuto(): ?int
    {
        return $this->amountVDAuto;
    }

    public function setAmountVDAuto(?int $amountVDAuto): void
    {
        $this->amountVDAuto = $amountVDAuto;
    }

    public function getAmountPercentVDAuto(): ?float
    {
        return null !== $this->amountPercentVDAuto ? (float) $this->amountPercentVDAuto : null;
    }

    public function setAmountPercentVDAuto(?float $amountPercentVDAuto): void
    {
        $this->amountPercentVDAuto = null !== $amountPercentVDAuto ? (string) $amountPercentVDAuto : null;
    }

    public function getAmountFixedBeforeMargeAuto(): ?int
    {
        return $this->amountFixedBeforeMargeAuto;
    }

    public function setAmountFixedBeforeMargeAuto(?int $amountFixedBeforeMargeAuto): void
    {
        $this->amountFixedBeforeMargeAuto = $amountFixedBeforeMargeAuto;
    }

    public function getAmountFixedAuto(): ?int
    {
        return $this->amountFixedAuto;
    }

    public function setAmountFixedAuto(?int $amountFixedAuto = null): void
    {
        $this->amountFixedAuto = $amountFixedAuto;
    }

    public function getAmountFixedManu(): ?int
    {
        return $this->amountFixedManu;
    }

    public function setAmountFixedManu(?int $amountFixedManu = null): void
    {
        $this->amountFixedManu = $amountFixedManu;
    }

    public function getHighMountainAmount(): ?int
    {
        return $this->highMountainAmount;
    }

    public function setHighMountainAmount(?int $highMountainAmount = null): void
    {
        $this->highMountainAmount = $highMountainAmount;
    }

    public function getAmountFreeShipping(): ?int
    {
        return $this->amountFreeShipping;
    }

    public function setAmountFreeShipping(?int $amountFreeShipping = null): void
    {
        $this->amountFreeShipping = $amountFreeShipping;
    }

    public function isForceEquivalencyForAuto(): bool
    {
        return $this->forceEquivalencyForAuto;
    }

    public function setForceEquivalencyForAuto(bool $forceEquivalencyForAuto): void
    {
        $this->forceEquivalencyForAuto = $forceEquivalencyForAuto;
    }

    public function getCarrier(): ?string
    {
        return $this->carrier;
    }

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

    public function getFileSup(): ?ModelFile
    {
        return $this->fileSup;
    }

    public function setFileSup(?ModelFile $fileSup = null): void
    {
        $this->fileSup = $fileSup;
    }
}
