<?php

declare(strict_types=1);

namespace System\Database;

final class ColumnDefinition
{
    public function __construct(
        public string $name,
        public string $type,
        public ?int $length = null
    ) {
    }
public ?string $references = null;

public ?string $on = null;
    public bool $nullable = false;

    public bool $unique = false;

    public mixed $default = null;

    public bool $unsigned = false;

    public bool $primary = false;

    public bool $autoIncrement = false;

    public function nullable(): self
    {
        $this->nullable = true;

        return $this;
    }

    public function unique(): self
    {
        $this->unique = true;

        return $this;
    }
public function constrained(string $table): self
{
    $this->references = 'id';

    $this->on = $table;

    return $this;
}
    public function default(mixed $value): self
    {
        $this->default = $value;

        return $this;
    }
}