<?php
/**
 * _             _       _
 * | |____      _| | __ _| |__
 * | '_ \ \ /\ / / |/ _` | '_ \
 * | |_) \ V  V /| | (_| | |_) |
 * |_.__/ \_/\_/ |_|\__,_|_.__/.
 *
 * @author    Bwlab di Luigi Massa <info@bwlab.it>
 * @copyright since 2014 Bwlab
 * @license   proprietary
 */

declare(strict_types=1);

namespace Bwlab\Withdrawal\Entity;

if (!defined('_PS_VERSION_')) {
    exit;
}

use Doctrine\ORM\Mapping as ORM;

/**
 * @ORM\Table()
 * @ORM\Entity(repositoryClass="Bwlab\Withdrawal\Repository\WithdrawalCategoryConfigRepository")
 * @ORM\HasLifecycleCallbacks()
 */
class WithdrawalCategoryConfig
{
    /**
     * @ORM\Id
     * @ORM\GeneratedValue(strategy="IDENTITY")
     * @ORM\Column(name="id_withdrawal_category_config", type="integer", nullable=false)
     */
    private ?int $id = null;

    /**
     * @ORM\Column(name="id_category", type="integer", nullable=false)
     */
    private int $idCategory;

    /**
     * @ORM\Column(name="id_shop", type="integer", nullable=false)
     */
    private int $idShop;

    /**
     * @ORM\Column(name="withdrawal_days", type="integer", nullable=false, options={"default": 14})
     */
    private int $withdrawalDays = 14;

    /**
     * @ORM\Column(name="is_excluded", type="boolean", nullable=false, options={"default": false})
     */
    private bool $isExcluded = false;

    /**
     * @ORM\Column(name="date_add", type="datetime", nullable=false)
     */
    private \DateTimeInterface $dateAdd;

    /**
     * @ORM\Column(name="date_upd", type="datetime", nullable=false)
     */
    private \DateTimeInterface $dateUpd;

    /**
     * @ORM\PrePersist()
     */
    public function prePersist(): void
    {
        $now = new \DateTime();
        $this->dateAdd = $now;
        $this->dateUpd = $now;
    }

    /**
     * @ORM\PreUpdate()
     */
    public function preUpdate(): void
    {
        $this->dateUpd = new \DateTime();
    }

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

    public function getIdCategory(): int
    {
        return $this->idCategory;
    }

    public function setIdCategory(int $idCategory): self
    {
        $this->idCategory = $idCategory;

        return $this;
    }

    public function getIdShop(): int
    {
        return $this->idShop;
    }

    public function setIdShop(int $idShop): self
    {
        $this->idShop = $idShop;

        return $this;
    }

    public function getWithdrawalDays(): int
    {
        return $this->withdrawalDays;
    }

    public function setWithdrawalDays(int $withdrawalDays): self
    {
        $this->withdrawalDays = $withdrawalDays;

        return $this;
    }

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

    public function setIsExcluded(bool $isExcluded): self
    {
        $this->isExcluded = $isExcluded;

        return $this;
    }

    public function getDateAdd(): \DateTimeInterface
    {
        return $this->dateAdd;
    }

    public function getDateUpd(): \DateTimeInterface
    {
        return $this->dateUpd;
    }
}
