<?php

namespace Lucent\Schema;

final class Nullable
{
    public function __construct(
        public bool  $nullable,
        public mixed $value,
        public mixed $default,
    )
    {
    }

    public function value(): mixed
    {

        if (!empty($this->value)) {
            return $this->value;
        }

        if ($this->nullable) {
            return null;
        }
        return $this->default;
    }
}
