<?php

declare(strict_types=1);

namespace App\Modules\Shared\Domain\ValueObject;

abstract class NumericValueObject
{

    protected float $value;

    public function __construct(float $value)
    {
        $this->value = $value;
    }

    public function value(): float
    {
        return $this->value;
    }

    /** Greater than */
    public function gt(NumericValueObject $other): bool
    {
        return $this->value() > $other->value();
    }

    /** Less than */
    public function lt(NumericValueObject $other): bool
    {
        return $this->value() < $other->value();
    }

    /** Equals */
    public function eq(NumericValueObject $other): bool
    {
        return $this->value() === $other->value();
    }

    /** Greater than or equals */
    public function gte(NumericValueObject $other): bool
    {
        return $this->gt($other) || $this->eq($other);
    }

    /** Less than or equals */
    public function lte(NumericValueObject $other): bool
    {
        return $this->lt($other) || $this->eq($other);
    }
}
