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

use CpCreation\VitiCore\Behavior\HasTimestamp;
use CpCreation\VitiCore\Behavior\Impl\Timestamp;
use Doctrine\ORM\Mapping as ORM;
use Ramsey\Uuid\Uuid;
use Ramsey\Uuid\UuidInterface;

#[ORM\Entity(repositoryClass: 'CpCreation\VitiCore\Shop\Repository\ShippingTaxRepository')]
#[ORM\Table(name: 'shop_shipping_tax')]
#[ORM\HasLifecycleCallbacks]
class ShippingTax implements HasTimestamp
{
    use Timestamp;

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

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

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

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

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

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

    #[ORM\Column(type: 'decimal', precision: 3, scale: 2)]
    private ?string $value = null;

    public function __construct()
    {
        $this->id = Uuid::uuid4();
        $this->byDefault = false;
        $this->inPro = true;
        $this->outPro = false;
        $this->inCustomer = true;
        $this->outCustomer = true;
    }

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

    public function isByDefault(): bool
    {
        return $this->byDefault;
    }

    public function setByDefault(bool $byDefault): void
    {
        $this->byDefault = $byDefault;
    }

    public function isInPro(): bool
    {
        return $this->inPro;
    }

    public function setInPro(bool $inPro): void
    {
        $this->inPro = $inPro;
    }

    public function isOutPro(): bool
    {
        return $this->outPro;
    }

    public function setOutPro(bool $outPro): void
    {
        $this->outPro = $outPro;
    }

    public function isInCustomer(): bool
    {
        return $this->inCustomer;
    }

    public function setInCustomer(bool $inCustomer): void
    {
        $this->inCustomer = $inCustomer;
    }

    public function isOutCustomer(): bool
    {
        return $this->outCustomer;
    }

    public function setOutCustomer(bool $outCustomer): void
    {
        $this->outCustomer = $outCustomer;
    }

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

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