<?php
/**
 * Jingga
 *
 * PHP Version 8.2
 *
 * @package   Modules\Billing\Models
 * @copyright Dennis Eichhorn
 * @license   OMS License 2.2
 * @version   1.0.0
 * @link      https://jingga.app
 */
declare(strict_types=1);

namespace Modules\Billing\Models;

use phpOMS\Stdlib\Base\FloatInt;

/**
 * Subscription class.
 *
 * @package Modules\Billing\Models
 * @license OMS License 2.2
 * @link    https://jingga.app
 * @since   1.0.0
 */
class Subscription implements \JsonSerializable
{
    /**
     * ID.
     *
     * @var int
     * @since 1.0.0
     */
    public int $id = 0;

    public int $status = 0;

    public \DateTime $start;

    public ?\DateTime $end = null;

    public FloatInt $price;

    public int $bill = 0;

    public int $item = 0;

    public bool $autoRenew = false;

    public int $client = 0;

    public FloatInt $quantity;

    /**
     * Constructor.
     *
     * @since 1.0.0
     */
    public function __construct()
    {
        $price    = new FloatInt();
        $quantity = new FloatInt();
    }

    /**
     * {@inheritdoc}
     */
    public function toArray() : array
    {
        return [
            'id' => $this->id,
        ];
    }

    /**
     * {@inheritdoc}
     */
    public function jsonSerialize() : mixed
    {
        return $this->toArray();
    }
}
