<?php

namespace Lucent\Record;

use Lucent\LucentException;

class QueryRecord
{

    function __construct(
        public string     $id,
        public string     $schema,
        public Status     $status,
        public System     $_sys,
        public RecordData $data,
        public bool       $isRoot,
        public ?File      $_file = null,
        public array      $_children = [],
        public array      $_parents = [],
    )
    {
    }

    public static function fromRecord(Record $record): QueryRecord
    {
        return new QueryRecord(
            id: $record->id,
            schema: $record->schema,
            status: $record->status,
            _sys: $record->_sys,
            data: $record->data,
            isRoot: false,
            _file: $record->_file,
        );
    }
}
