<?php
/**
 * 2007-2023 PrestaShop
 *
 * NOTICE OF LICENSE
 *
 * This source file is subject to the Academic Free License (AFL 3.0)
 * that is bundled with this package in the file LICENSE.txt.
 * It is also available through the world-wide-web at this URL:
 * http://opensource.org/licenses/afl-3.0.php
 * If you did not receive a copy of the license and are unable to
 * obtain it through the world-wide-web, please send an email
 * to license@prestashop.com so we can send you a copy immediately.
 *
 * DISCLAIMER
 *
 * Do not edit or add to this file if you wish to upgrade PrestaShop to newer
 * versions in the future. If you wish to customize PrestaShop for your
 * needs please refer to http://www.prestashop.com for more information.
 *
 *  @author    PrestaShop SA <contact@prestashop.com>
 *  @copyright 2007-2023 PrestaShop SA
 *  @license   http://opensource.org/licenses/afl-3.0.php  Academic Free License (AFL 3.0)
 *  International Registered Trademark & Property of PrestaShop SA
 */
declare(strict_types=1);

namespace PrestaShop\Module\AgileMultisellerPro\Entity;

use Doctrine\ORM\Mapping as ORM;

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

/**
 * SellerinfoMembershipHistory
 *
 * @ORM\Table()
 * @ORM\Entity(repositoryClass="PrestaShop\Module\AgileMultisellerPro\Repository\SellerinfoMembershipHistoryRepository")
 * @ORM\HasLifecycleCallbacks
 */
class SellerinfoMembershipHistory
{
    /**
     * @var bigint
     *
     * @ORM\Id
     * @ORM\Column(name="id_membership_history", type="bigint", nullable=false)
     * @ORM\GeneratedValue(strategy="AUTO")
     */
    private $idMembershipHistory;

    /**
     * @var bigint
     *
     * @ORM\Column(name="id_customer", type="bigint", nullable=false)
     */
    private $idCustomer;

    /**
     * @var bigint
     *
     * @ORM\Column(name="id_product", type="bigint", nullable=true)
     */
    private $idProduct;

    /**
     * @var bigint
     *
     * @ORM\Column(name="id_product_attribute", type="bigint", nullable=true)
     */
    private $idProductAttribute;

    /**
     * @var bigint
     *
     * @ORM\Column(name="id_order", type="bigint", nullable=true)
     */
    private $idOrder;

    /**
     * @var bigint
     *
     * @ORM\Column(name="id_order_state", type="bigint", nullable=true)
     */
    private $idOrderState;

    /**
     * @var bigint
     *
     * @ORM\Column(name="quantity", type="bigint", nullable=true)
     */
    private $quantity;

    /**
     * @var string
     *
     * @ORM\Column(name="`interval`", type="string", length=64, nullable=true)
     */
    private $interval;

    /**
     * @var bigint
     *
     * @ORM\Column(name="units", type="bigint", nullable=true)
     */
    private $units;

    /**
     * @var bool
     *
     * @ORM\Column(name="is_cancelled", type="integer", nullable=true)
     */
    private $isCancelled = false;

    /**
     * @var \DateTime
     *
     * @ORM\Column(name="date_start", type="datetime", nullable=true)
     */
    private $dateStart;

    /**
     * @var \DateTime
     *
     * @ORM\Column(name="expiry_date", type="datetime", nullable=true)
     */
    private $expiryDate;

    /**
     * @var \DateTime
     *
     * @ORM\Column(name="date_cancelled", type="datetime", nullable=true)
     */
    private $dateCancelled;

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

    public function getIdMembershipHistory(): ?int
    {
        if (!empty($this->idMembershipHistory)) {
            return (int) $this->idMembershipHistory;
        } else {
            return $this->idMembershipHistory;
        }
    }

    public function getIdCustomer(): int
    {
        return (int) $this->idCustomer;
    }

    public function setIdCustomer(?int $idCustomer): self
    {
        $this->idCustomer = $idCustomer;

        return $this;
    }

    public function getIdProduct(): int
    {
        return (int) $this->idProduct;
    }

    public function setIdProduct(?int $idProduct): self
    {
        $this->idProduct = $idProduct;

        return $this;
    }

    public function getIdProductAttribute(): int
    {
        return (int) $this->idProductAttribute;
    }

    public function setIdProductAttribute(?int $idProductAttribute): self
    {
        $this->idProductAttribute = $idProductAttribute;

        return $this;
    }

    public function getIdOrder(): ?int
    {
        return (int) $this->idOrder;
    }

    public function setIdOrder(int $idOrder): self
    {
        $this->idOrder = $idOrder;

        return $this;
    }

    public function getIdOrderState(): ?int
    {
        return (int) $this->idOrderState;
    }

    public function setIdOrderState(int $idOrderState): self
    {
        $this->idOrderState = $idOrderState;

        return $this;
    }

    public function getQuantity(): ?int
    {
        return (int) $this->quantity;
    }

    public function setQuantity(int $quantity): self
    {
        $this->quantity = $quantity;

        return $this;
    }

    public function getIinterval(): ?string
    {
        return $this->interval;
    }

    public function setInterval(?string $interval): self
    {
        $this->interval = $interval;

        return $this;
    }

    public function getUnits(): ?int
    {
        return (int) $this->units;
    }

    public function setUnits(?int $units): self
    {
        $this->units = $units;

        return $this;
    }

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

    public function setIsCancelled(bool $isCancelled): self
    {
        $this->isCancelled = $isCancelled;

        return $this;
    }

    public function getDateStart(): ?\DateTimeInterface
    {
        return $this->dateStart;
    }

    public function setDateStart(\DateTimeInterface $dateStart): self
    {
        $this->dateStart = $dateStart;

        return $this;
    }

    public function getExpiryDate(): ?\DateTimeInterface
    {
        return $this->expiryDate;
    }

    public function setExpiryDate(\DateTimeInterface $expiryDate): self
    {
        $this->expiryDate = $expiryDate;

        return $this;
    }

    public function getDateCancelled(): ?\DateTimeInterface
    {
        return $this->dateCancelled;
    }

    public function setDateCancelled(\DateTimeInterface $dateCancelled): self
    {
        $this->dateCancelled = $dateCancelled;

        return $this;
    }

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

    public function setDateAdd(\DateTimeInterface $dateAdd): self
    {
        $this->dateAdd = $dateAdd;

        return $this;
    }

    /**
     * @ORM\PrePersist
     */
    public function setDefaultDateAdd(): void
    {
        if ($this->dateAdd === null) {
            $this->dateAdd = new \DateTime();
        }
    }
}
