<?php

declare(strict_types=1);

namespace App\Framework\Database\Metadata;

final readonly class PropertyMetadata
{
    public function __construct(
        public string $name,
        public string $columnName,
        public string $type,
        public bool $nullable,
        public bool $hasDefault,
        public mixed $defaultValue,
        public array $allTypes = [],
        public bool $primary = false,
        public bool $autoIncrement = false,
        // Eigenschaften für Relationen
        public bool $isRelation = false,
        public ?string $relationTargetClass = null,
        public ?string $relationForeignKey = null,
        public ?string $relationLocalKey = null,
        public string $relationType = 'hasMany'
    ) {
    }

    public function isUnionType(): bool
    {
        return count($this->allTypes) > 1;
    }
}
